Skip to content

Commit 0e3cae9

Browse files
committed
Merge branch 'release/1.0.7'
2 parents 31786fb + ef5ae1c commit 0e3cae9

File tree

2 files changed

+19
-16
lines changed

2 files changed

+19
-16
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# CHANGELOG
22

3+
## 1.0.7
4+
- Issue #3 - More than one SoapClient in Project
5+
36
## 1.0.6
47
- Pull request #4: Rename $optioName to $optionName
58

src/AbstractSoapClientBase.php

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public static function setSoapClient(\SoapClient $soapClient)
6666
public function initSoapClient(array $options)
6767
{
6868
$wsdlOptions = array();
69-
$defaultWsdlOptions = self::getDefaultWsdlOptions();
69+
$defaultWsdlOptions = static::getDefaultWsdlOptions();
7070
foreach ($defaultWsdlOptions as $optionName => $optionValue) {
7171
if (array_key_exists($optionName, $options) && !empty($options[$optionName])) {
7272
$wsdlOptions[str_replace(self::OPTION_PREFIX, '', $optionName)] = $options[$optionName];
@@ -78,7 +78,7 @@ public function initSoapClient(array $options)
7878
$wsdlUrl = $wsdlOptions[str_replace(self::OPTION_PREFIX, '', self::WSDL_URL)];
7979
unset($wsdlOptions[str_replace(self::OPTION_PREFIX, '', self::WSDL_URL)]);
8080
$soapClientClassName = $this->getSoapClientClassName();
81-
self::setSoapClient(new $soapClientClassName($wsdlUrl, $wsdlOptions));
81+
static::setSoapClient(new $soapClientClassName($wsdlUrl, $wsdlOptions));
8282
}
8383
}
8484
/**
@@ -165,8 +165,8 @@ public static function getDefaultWsdlOptions()
165165
*/
166166
public function setLocation($location)
167167
{
168-
if (self::getSoapClient() instanceof \SoapClient) {
169-
self::getSoapClient()->__setLocation($location);
168+
if (static::getSoapClient() instanceof \SoapClient) {
169+
static::getSoapClient()->__setLocation($location);
170170
}
171171
return $this;
172172
}
@@ -204,8 +204,8 @@ public function getLastResponse($asDomDocument = false)
204204
protected function getLastXml($method, $asDomDocument = false)
205205
{
206206
$xml = null;
207-
if (self::getSoapClient() instanceof \SoapClient) {
208-
$xml = self::getFormatedXml(self::getSoapClient()->$method(), $asDomDocument);
207+
if (static::getSoapClient() instanceof \SoapClient) {
208+
$xml = static::getFormatedXml(static::getSoapClient()->$method(), $asDomDocument);
209209
}
210210
return $xml;
211211
}
@@ -242,9 +242,9 @@ public function getLastResponseHeaders($asArray = false)
242242
*/
243243
protected function getLastHeaders($method, $asArray)
244244
{
245-
$headers = self::getSoapClient() instanceof \SoapClient ? self::getSoapClient()->$method() : null;
245+
$headers = static::getSoapClient() instanceof \SoapClient ? static::getSoapClient()->$method() : null;
246246
if (is_string($headers) && $asArray) {
247-
return self::convertStringHeadersToArray($headers);
247+
return static::convertStringHeadersToArray($headers);
248248
}
249249
return $headers;
250250
}
@@ -291,21 +291,21 @@ public static function convertStringHeadersToArray($headers)
291291
*/
292292
public function setSoapHeader($nameSpace, $name, $data, $mustUnderstand = false, $actor = null)
293293
{
294-
if (self::getSoapClient()) {
295-
$defaultHeaders = (isset(self::getSoapClient()->__default_headers) && is_array(self::getSoapClient()->__default_headers)) ? self::getSoapClient()->__default_headers : array();
294+
if (static::getSoapClient()) {
295+
$defaultHeaders = (isset(static::getSoapClient()->__default_headers) && is_array(static::getSoapClient()->__default_headers)) ? static::getSoapClient()->__default_headers : array();
296296
foreach ($defaultHeaders as $index => $soapHeader) {
297297
if ($soapHeader->name === $name) {
298298
unset($defaultHeaders[$index]);
299299
break;
300300
}
301301
}
302-
self::getSoapClient()->__setSoapheaders(null);
302+
static::getSoapClient()->__setSoapheaders(null);
303303
if (!empty($actor)) {
304304
array_push($defaultHeaders, new \SoapHeader($nameSpace, $name, $data, $mustUnderstand, $actor));
305305
} else {
306306
array_push($defaultHeaders, new \SoapHeader($nameSpace, $name, $data, $mustUnderstand));
307307
}
308-
self::getSoapClient()->__setSoapheaders($defaultHeaders);
308+
static::getSoapClient()->__setSoapheaders($defaultHeaders);
309309
}
310310
return $this;
311311
}
@@ -321,7 +321,7 @@ public function setSoapHeader($nameSpace, $name, $data, $mustUnderstand = false,
321321
public function setHttpHeader($headerName, $headerValue)
322322
{
323323
$state = false;
324-
if (self::getSoapClient() && !empty($headerName)) {
324+
if (static::getSoapClient() && !empty($headerName)) {
325325
$streamContext = $this->getStreamContext();
326326
if ($streamContext === null) {
327327
$options = array();
@@ -359,12 +359,12 @@ public function setHttpHeader($headerName, $headerValue)
359359
* Create context if it does not exist
360360
*/
361361
if ($streamContext === null) {
362-
$state = (self::getSoapClient()->_stream_context = stream_context_create($options)) ? true : false;
362+
$state = (static::getSoapClient()->_stream_context = stream_context_create($options)) ? true : false;
363363
} else {
364364
/**
365365
* Set the new context http header option
366366
*/
367-
$state = stream_context_set_option(self::getSoapClient()->_stream_context, 'http', 'header', $options['http']['header']);
367+
$state = stream_context_set_option(static::getSoapClient()->_stream_context, 'http', 'header', $options['http']['header']);
368368
}
369369
}
370370
}
@@ -376,7 +376,7 @@ public function setHttpHeader($headerName, $headerValue)
376376
*/
377377
public function getStreamContext()
378378
{
379-
return (self::getSoapClient() && isset(self::getSoapClient()->_stream_context) && is_resource(self::getSoapClient()->_stream_context)) ? self::getSoapClient()->_stream_context : null;
379+
return (static::getSoapClient() && isset(static::getSoapClient()->_stream_context) && is_resource(static::getSoapClient()->_stream_context)) ? static::getSoapClient()->_stream_context : null;
380380
}
381381
/**
382382
* Returns current \SoapClient::_stream_context resource options or empty array

0 commit comments

Comments
 (0)