Skip to content

Commit

Permalink
fix: avoid conflict constants (#49)
Browse files Browse the repository at this point in the history
  • Loading branch information
crimson-gao authored Sep 27, 2024
1 parent 7b45bf6 commit 94fff2f
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 36 deletions.
12 changes: 6 additions & 6 deletions Aliyun/Log/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
require_once realpath ( dirname ( __FILE__ ) . '/sls.proto.php' );
require_once realpath ( dirname ( __FILE__ ) . '/protocolbuffers.inc.php' );

if(!defined('API_VERSION'))
define('API_VERSION', '0.6.0');
if(!defined('USER_AGENT'))
define('USER_AGENT', 'log-php-sdk-v-0.6.0');
if(!defined('SLS_API_VERSION'))
define('SLS_API_VERSION', '0.6.0');
if(!defined('SLS_USER_AGENT'))
define('SLS_USER_AGENT', 'log-php-sdk-v-0.6.0');

/**
* Aliyun_Log_Client class is the main class in the SDK. It can be used to
Expand Down Expand Up @@ -153,7 +153,7 @@ protected function getHttpResponse($method, $url, $body, $headers) {
foreach ( $headers as $key => $value )
$request->add_header ( $key, $value );
$request->set_method ( $method );
$request->set_useragent(USER_AGENT);
$request->set_useragent(SLS_USER_AGENT);
if ($method == "POST" || $method == "PUT")
$request->set_body ( $body );
$request->send_request ();
Expand Down Expand Up @@ -225,7 +225,7 @@ private function send($method, $project, $body, $resource, $params, $headers) {
$headers ['Content-Type'] = ''; // If not set, http request will add automatically.
}

$headers ['x-log-apiversion'] = API_VERSION;
$headers ['x-log-apiversion'] = SLS_API_VERSION;
$headers ['x-log-signaturemethod'] = 'hmac-sha1';
if(strlen($credentials->getSecurityToken()) >0)
$headers ['x-acs-security-token'] = $credentials->getSecurityToken();
Expand Down
12 changes: 6 additions & 6 deletions docs/namespaces/default.html
Original file line number Diff line number Diff line change
Expand Up @@ -135,21 +135,21 @@

<div class="namespace-indent">
<h3><i class="icon-custom icon-constant"></i> Constants</h3>
<div id="constant_API_VERSION" class="element ajax clickable constant" data-toggle="collapse" data-target="#constant_API_VERSION .collapse">
<h1>API_VERSION<a href="../namespaces/default.html#constant_API_VERSION"></a></h1>
<div id="constant_SLS_API_VERSION" class="element ajax clickable constant" data-toggle="collapse" data-target="#constant_SLS_API_VERSION .collapse">
<h1>SLS_API_VERSION<a href="../namespaces/default.html#constant_SLS_API_VERSION"></a></h1>
<p class="short_description"></p>
<div class="details collapse">

</div>
<a href="../namespaces/default.html#constant_API_VERSION" class="more">« More »</a> </div>
<a href="../namespaces/default.html#constant_SLS_API_VERSION" class="more">« More »</a> </div>

<div id="constant_USER_AGENT" class="element ajax clickable constant" data-toggle="collapse" data-target="#constant_USER_AGENT .collapse">
<h1>USER_AGENT<a href="../namespaces/default.html#constant_USER_AGENT"></a></h1>
<div id="constant_SLS_USER_AGENT" class="element ajax clickable constant" data-toggle="collapse" data-target="#constant_SLS_USER_AGENT .collapse">
<h1>SLS_USER_AGENT<a href="../namespaces/default.html#constant_SLS_USER_AGENT"></a></h1>
<p class="short_description"></p>
<div class="details collapse">

</div>
<a href="../namespaces/default.html#constant_USER_AGENT" class="more">« More »</a> </div>
<a href="../namespaces/default.html#constant_SLS_USER_AGENT" class="more">« More »</a> </div>

</div>

Expand Down
12 changes: 6 additions & 6 deletions docs/packages/LOG.PHP.SDK.html
Original file line number Diff line number Diff line change
Expand Up @@ -135,18 +135,18 @@

<div class="package-indent">
<h3><i class="icon-custom icon-constant"></i> Constants</h3>
<div id="API_VERSION" class="element ajax clickable constant">
<h1>API_VERSION<a href="../namespaces/default.html#constant_API_VERSION"></a></h1>
<div id="SLS_API_VERSION" class="element ajax clickable constant">
<h1>SLS_API_VERSION<a href="../namespaces/default.html#constant_SLS_API_VERSION"></a></h1>
<p class="short_description"></p>
<div class="details collapse"></div>
<a href="../namespaces/default.html#constant_API_VERSION" class="more">« More »</a>
<a href="../namespaces/default.html#constant_SLS_API_VERSION" class="more">« More »</a>
</div>

<div id="USER_AGENT" class="element ajax clickable constant">
<h1>USER_AGENT<a href="../namespaces/default.html#constant_USER_AGENT"></a></h1>
<div id="SLS_USER_AGENT" class="element ajax clickable constant">
<h1>SLS_USER_AGENT<a href="../namespaces/default.html#constant_SLS_USER_AGENT"></a></h1>
<p class="short_description"></p>
<div class="details collapse"></div>
<a href="../namespaces/default.html#constant_USER_AGENT" class="more">« More »</a>
<a href="../namespaces/default.html#constant_SLS_USER_AGENT" class="more">« More »</a>
</div>

</div>
Expand Down
16 changes: 8 additions & 8 deletions docs/packages/SLS_PHP_SDK.html
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@
<li><a href="#Aliyun_Log_Models_GetLogsResponse" title="The response of the GetLog API from sls.">Aliyun_Log_Models_GetLogsResponse</a></li>
<li class="nav-header">
<i title="Constants" class="icon-custom icon-constant"></i> Constants</li>
<li class="constant "><a href="#constant_API_VERSION" title="API_VERSION() :: "><span class="description">API_VERSION</span><pre>API_VERSION</pre></a></li>
<li class="constant "><a href="#constant_USER_AGENT" title="USER_AGENT() :: "><span class="description">USER_AGENT</span><pre>USER_AGENT</pre></a></li>
<li class="constant "><a href="#constant_SLS_API_VERSION" title="SLS_API_VERSION() :: "><span class="description">SLS_API_VERSION</span><pre>SLS_API_VERSION</pre></a></li>
<li class="constant "><a href="#constant_SLS_USER_AGENT" title="SLS_USER_AGENT() :: "><span class="description">SLS_USER_AGENT</span><pre>SLS_USER_AGENT</pre></a></li>
</ul>
</div>
<div class="span8 package-contents">
Expand Down Expand Up @@ -305,9 +305,9 @@ <h1>ResponseCore<a href="../classes/ResponseCore.html">¶</a>
</div>
<h3>
<i title="Constants" class="icon-custom icon-constant"></i> Constants</h3>
<a xmlns:php="http://php.net/xsl" id="constant_API_VERSION"> </a><div xmlns:php="http://php.net/xsl" class="element clickable constant constant_API_VERSION" data-toggle="collapse" data-target=".constant_API_VERSION .collapse" title="">
<h2>API_VERSION</h2>
<pre>API_VERSION = '0.4.0' </pre>
<a xmlns:php="http://php.net/xsl" id="constant_SLS_API_VERSION"> </a><div xmlns:php="http://php.net/xsl" class="element clickable constant constant_SLS_API_VERSION" data-toggle="collapse" data-target=".constant_SLS_API_VERSION .collapse" title="">
<h2>SLS_API_VERSION</h2>
<pre>SLS_API_VERSION = '0.4.0' </pre>
<div class="labels"></div>
<div class="row collapse"><div class="detail-description">
<div class="long_description"></div>
Expand All @@ -317,9 +317,9 @@ <h2>API_VERSION</h2>
</tr></table>
</div></div>
</div>
<a xmlns:php="http://php.net/xsl" id="constant_USER_AGENT"> </a><div xmlns:php="http://php.net/xsl" class="element clickable constant constant_USER_AGENT" data-toggle="collapse" data-target=".constant_USER_AGENT .collapse" title="">
<h2>USER_AGENT</h2>
<pre>USER_AGENT = 'sls-php-sdk-v-0.4.1' </pre>
<a xmlns:php="http://php.net/xsl" id="constant_SLS_USER_AGENT"> </a><div xmlns:php="http://php.net/xsl" class="element clickable constant constant_SLS_USER_AGENT" data-toggle="collapse" data-target=".constant_SLS_USER_AGENT .collapse" title="">
<h2>SLS_USER_AGENT</h2>
<pre>SLS_USER_AGENT = 'sls-php-sdk-v-0.4.1' </pre>
<div class="labels"></div>
<div class="row collapse"><div class="detail-description">
<div class="long_description"></div>
Expand Down
12 changes: 6 additions & 6 deletions docs/packages/default.html
Original file line number Diff line number Diff line change
Expand Up @@ -156,18 +156,18 @@

<div class="package-indent">
<h3><i class="icon-custom icon-constant"></i> Constants</h3>
<div id="API_VERSION" class="element ajax clickable constant">
<h1>API_VERSION<a href="../namespaces/default.html#constant_API_VERSION"></a></h1>
<div id="SLS_API_VERSION" class="element ajax clickable constant">
<h1>SLS_API_VERSION<a href="../namespaces/default.html#constant_SLS_API_VERSION"></a></h1>
<p class="short_description"></p>
<div class="details collapse"></div>
<a href="../namespaces/default.html#constant_API_VERSION" class="more">« More »</a>
<a href="../namespaces/default.html#constant_SLS_API_VERSION" class="more">« More »</a>
</div>

<div id="USER_AGENT" class="element ajax clickable constant">
<h1>USER_AGENT<a href="../namespaces/default.html#constant_USER_AGENT"></a></h1>
<div id="SLS_USER_AGENT" class="element ajax clickable constant">
<h1>SLS_USER_AGENT<a href="../namespaces/default.html#constant_SLS_USER_AGENT"></a></h1>
<p class="short_description"></p>
<div class="details collapse"></div>
<a href="../namespaces/default.html#constant_USER_AGENT" class="more">« More »</a>
<a href="../namespaces/default.html#constant_SLS_USER_AGENT" class="more">« More »</a>
</div>

</div>
Expand Down
8 changes: 4 additions & 4 deletions docs/structure.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2991,8 +2991,8 @@ All rights reserved</description>
<tag name="package" line="0" description="SLS_PHP_SDK"/>
</docblock>
<constant namespace="" line="14" package="SLS_PHP_SDK">
<name>API_VERSION</name>
<full_name>\API_VERSION</full_name>
<name>SLS_API_VERSION</name>
<full_name>\SLS_API_VERSION</full_name>
<value>'0.4.0'</value>
<docblock line="14">
<description></description>
Expand All @@ -3001,8 +3001,8 @@ All rights reserved</description>
</docblock>
</constant>
<constant namespace="" line="16" package="SLS_PHP_SDK">
<name>USER_AGENT</name>
<full_name>\USER_AGENT</full_name>
<name>SLS_USER_AGENT</name>
<full_name>\SLS_USER_AGENT</full_name>
<value>'sls-php-sdk-v-0.4.1'</value>
<docblock line="16">
<description></description>
Expand Down

0 comments on commit 94fff2f

Please sign in to comment.