Skip to content

Commit 94fff2f

Browse files
authored
fix: avoid conflict constants (#49)
1 parent 7b45bf6 commit 94fff2f

File tree

6 files changed

+36
-36
lines changed

6 files changed

+36
-36
lines changed

Aliyun/Log/Client.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010
require_once realpath ( dirname ( __FILE__ ) . '/sls.proto.php' );
1111
require_once realpath ( dirname ( __FILE__ ) . '/protocolbuffers.inc.php' );
1212

13-
if(!defined('API_VERSION'))
14-
define('API_VERSION', '0.6.0');
15-
if(!defined('USER_AGENT'))
16-
define('USER_AGENT', 'log-php-sdk-v-0.6.0');
13+
if(!defined('SLS_API_VERSION'))
14+
define('SLS_API_VERSION', '0.6.0');
15+
if(!defined('SLS_USER_AGENT'))
16+
define('SLS_USER_AGENT', 'log-php-sdk-v-0.6.0');
1717

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

228-
$headers ['x-log-apiversion'] = API_VERSION;
228+
$headers ['x-log-apiversion'] = SLS_API_VERSION;
229229
$headers ['x-log-signaturemethod'] = 'hmac-sha1';
230230
if(strlen($credentials->getSecurityToken()) >0)
231231
$headers ['x-acs-security-token'] = $credentials->getSecurityToken();

docs/namespaces/default.html

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -135,21 +135,21 @@
135135

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

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

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

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

154154
</div>
155155

docs/packages/LOG.PHP.SDK.html

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -135,18 +135,18 @@
135135

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

145-
<div id="USER_AGENT" class="element ajax clickable constant">
146-
<h1>USER_AGENT<a href="../namespaces/default.html#constant_USER_AGENT"></a></h1>
145+
<div id="SLS_USER_AGENT" class="element ajax clickable constant">
146+
<h1>SLS_USER_AGENT<a href="../namespaces/default.html#constant_SLS_USER_AGENT"></a></h1>
147147
<p class="short_description"></p>
148148
<div class="details collapse"></div>
149-
<a href="../namespaces/default.html#constant_USER_AGENT" class="more">« More »</a>
149+
<a href="../namespaces/default.html#constant_SLS_USER_AGENT" class="more">« More »</a>
150150
</div>
151151

152152
</div>

docs/packages/SLS_PHP_SDK.html

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,8 @@
9696
<li><a href="#Aliyun_Log_Models_GetLogsResponse" title="The response of the GetLog API from sls.">Aliyun_Log_Models_GetLogsResponse</a></li>
9797
<li class="nav-header">
9898
<i title="Constants" class="icon-custom icon-constant"></i> Constants</li>
99-
<li class="constant "><a href="#constant_API_VERSION" title="API_VERSION() :: "><span class="description">API_VERSION</span><pre>API_VERSION</pre></a></li>
100-
<li class="constant "><a href="#constant_USER_AGENT" title="USER_AGENT() :: "><span class="description">USER_AGENT</span><pre>USER_AGENT</pre></a></li>
99+
<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>
100+
<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>
101101
</ul>
102102
</div>
103103
<div class="span8 package-contents">
@@ -305,9 +305,9 @@ <h1>ResponseCore<a href="../classes/ResponseCore.html">¶</a>
305305
</div>
306306
<h3>
307307
<i title="Constants" class="icon-custom icon-constant"></i> Constants</h3>
308-
<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="">
309-
<h2>API_VERSION</h2>
310-
<pre>API_VERSION = '0.4.0' </pre>
308+
<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="">
309+
<h2>SLS_API_VERSION</h2>
310+
<pre>SLS_API_VERSION = '0.4.0' </pre>
311311
<div class="labels"></div>
312312
<div class="row collapse"><div class="detail-description">
313313
<div class="long_description"></div>
@@ -317,9 +317,9 @@ <h2>API_VERSION</h2>
317317
</tr></table>
318318
</div></div>
319319
</div>
320-
<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="">
321-
<h2>USER_AGENT</h2>
322-
<pre>USER_AGENT = 'sls-php-sdk-v-0.4.1' </pre>
320+
<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="">
321+
<h2>SLS_USER_AGENT</h2>
322+
<pre>SLS_USER_AGENT = 'sls-php-sdk-v-0.4.1' </pre>
323323
<div class="labels"></div>
324324
<div class="row collapse"><div class="detail-description">
325325
<div class="long_description"></div>

docs/packages/default.html

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -156,18 +156,18 @@
156156

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

166-
<div id="USER_AGENT" class="element ajax clickable constant">
167-
<h1>USER_AGENT<a href="../namespaces/default.html#constant_USER_AGENT"></a></h1>
166+
<div id="SLS_USER_AGENT" class="element ajax clickable constant">
167+
<h1>SLS_USER_AGENT<a href="../namespaces/default.html#constant_SLS_USER_AGENT"></a></h1>
168168
<p class="short_description"></p>
169169
<div class="details collapse"></div>
170-
<a href="../namespaces/default.html#constant_USER_AGENT" class="more">« More »</a>
170+
<a href="../namespaces/default.html#constant_SLS_USER_AGENT" class="more">« More »</a>
171171
</div>
172172

173173
</div>

docs/structure.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2991,8 +2991,8 @@ All rights reserved</description>
29912991
<tag name="package" line="0" description="SLS_PHP_SDK"/>
29922992
</docblock>
29932993
<constant namespace="" line="14" package="SLS_PHP_SDK">
2994-
<name>API_VERSION</name>
2995-
<full_name>\API_VERSION</full_name>
2994+
<name>SLS_API_VERSION</name>
2995+
<full_name>\SLS_API_VERSION</full_name>
29962996
<value>'0.4.0'</value>
29972997
<docblock line="14">
29982998
<description></description>
@@ -3001,8 +3001,8 @@ All rights reserved</description>
30013001
</docblock>
30023002
</constant>
30033003
<constant namespace="" line="16" package="SLS_PHP_SDK">
3004-
<name>USER_AGENT</name>
3005-
<full_name>\USER_AGENT</full_name>
3004+
<name>SLS_USER_AGENT</name>
3005+
<full_name>\SLS_USER_AGENT</full_name>
30063006
<value>'sls-php-sdk-v-0.4.1'</value>
30073007
<docblock line="16">
30083008
<description></description>

0 commit comments

Comments
 (0)