@@ -8,7 +8,7 @@ abstract class AbstractSoapClientBase implements SoapClientInterface
88 * Soapclient called to communicate with the actual SOAP Service
99 * @var \SoapClient
1010 */
11- private static $ soapClient ;
11+ private $ soapClient ;
1212 /**
1313 * Contains Soap call result
1414 * @var mixed
@@ -24,35 +24,32 @@ abstract class AbstractSoapClientBase implements SoapClientInterface
2424 * @uses AbstractSoapClientBase::setLastError()
2525 * @uses AbstractSoapClientBase::initSoapClient()
2626 * @param array $wsdlOptions
27- * @param bool $resetSoapClient allows to disable the SoapClient redefinition
2827 */
29- public function __construct (array $ wsdlOptions = [], $ resetSoapClient = true )
28+ public function __construct (array $ wsdlOptions = [])
3029 {
3130 $ this ->setLastError ([]);
3231 /**
3332 * Init soap Client
3433 * Set default values
3534 */
36- if ($ resetSoapClient ) {
37- $ this ->initSoapClient ($ wsdlOptions );
38- }
35+ $ this ->initSoapClient ($ wsdlOptions );
3936 }
4037 /**
41- * Static method getting current SoapClient
38+ * Method getting current SoapClient
4239 * @return \SoapClient
4340 */
44- public static function getSoapClient ()
41+ public function getSoapClient ()
4542 {
46- return self :: $ soapClient ;
43+ return $ this -> soapClient ;
4744 }
4845 /**
49- * Static method setting current SoapClient
46+ * Method setting current SoapClient
5047 * @param \SoapClient $soapClient
5148 * @return \SoapClient
5249 */
53- public static function setSoapClient (\SoapClient $ soapClient )
50+ public function setSoapClient (\SoapClient $ soapClient )
5451 {
55- return (self :: $ soapClient = $ soapClient );
52+ return ($ this -> soapClient = $ soapClient );
5653 }
5754 /**
5855 * Method initiating SoapClient
@@ -78,7 +75,7 @@ public function initSoapClient(array $options)
7875 $ wsdlUrl = $ wsdlOptions [str_replace (self ::OPTION_PREFIX , '' , self ::WSDL_URL )];
7976 unset($ wsdlOptions [str_replace (self ::OPTION_PREFIX , '' , self ::WSDL_URL )]);
8077 $ soapClientClassName = $ this ->getSoapClientClassName ();
81- static :: setSoapClient (new $ soapClientClassName ($ wsdlUrl , $ wsdlOptions ));
78+ $ this -> setSoapClient (new $ soapClientClassName ($ wsdlUrl , $ wsdlOptions ));
8279 }
8380 }
8481 /**
@@ -167,8 +164,8 @@ public static function getDefaultWsdlOptions()
167164 */
168165 public function setLocation ($ location )
169166 {
170- if (static :: getSoapClient () instanceof \SoapClient) {
171- static :: getSoapClient ()->__setLocation ($ location );
167+ if ($ this -> getSoapClient () instanceof \SoapClient) {
168+ $ this -> getSoapClient ()->__setLocation ($ location );
172169 }
173170 return $ this ;
174171 }
@@ -206,8 +203,8 @@ public function getLastResponse($asDomDocument = false)
206203 protected function getLastXml ($ method , $ asDomDocument = false )
207204 {
208205 $ xml = null ;
209- if (static :: getSoapClient () instanceof \SoapClient) {
210- $ xml = static ::getFormatedXml (static :: getSoapClient ()->$ method (), $ asDomDocument );
206+ if ($ this -> getSoapClient () instanceof \SoapClient) {
207+ $ xml = static ::getFormatedXml ($ this -> getSoapClient ()->$ method (), $ asDomDocument );
211208 }
212209 return $ xml ;
213210 }
@@ -244,7 +241,7 @@ public function getLastResponseHeaders($asArray = false)
244241 */
245242 protected function getLastHeaders ($ method , $ asArray )
246243 {
247- $ headers = static :: getSoapClient () instanceof \SoapClient ? static :: getSoapClient ()->$ method () : null ;
244+ $ headers = $ this -> getSoapClient () instanceof \SoapClient ? $ this -> getSoapClient ()->$ method () : null ;
248245 if (is_string ($ headers ) && $ asArray ) {
249246 return static ::convertStringHeadersToArray ($ headers );
250247 }
@@ -293,21 +290,21 @@ public static function convertStringHeadersToArray($headers)
293290 */
294291 public function setSoapHeader ($ nameSpace , $ name , $ data , $ mustUnderstand = false , $ actor = null )
295292 {
296- if (static :: getSoapClient ()) {
297- $ defaultHeaders = (isset (static :: getSoapClient ()->__default_headers ) && is_array (static :: getSoapClient ()->__default_headers )) ? static :: getSoapClient ()->__default_headers : [];
293+ if ($ this -> getSoapClient ()) {
294+ $ defaultHeaders = (isset ($ this -> getSoapClient ()->__default_headers ) && is_array ($ this -> getSoapClient ()->__default_headers )) ? $ this -> getSoapClient ()->__default_headers : [];
298295 foreach ($ defaultHeaders as $ index => $ soapHeader ) {
299296 if ($ soapHeader ->name === $ name ) {
300297 unset($ defaultHeaders [$ index ]);
301298 break ;
302299 }
303300 }
304- static :: getSoapClient ()->__setSoapheaders (null );
301+ $ this -> getSoapClient ()->__setSoapheaders (null );
305302 if (!empty ($ actor )) {
306303 array_push ($ defaultHeaders , new \SoapHeader ($ nameSpace , $ name , $ data , $ mustUnderstand , $ actor ));
307304 } else {
308305 array_push ($ defaultHeaders , new \SoapHeader ($ nameSpace , $ name , $ data , $ mustUnderstand ));
309306 }
310- static :: getSoapClient ()->__setSoapheaders ($ defaultHeaders );
307+ $ this -> getSoapClient ()->__setSoapheaders ($ defaultHeaders );
311308 }
312309 return $ this ;
313310 }
@@ -323,7 +320,7 @@ public function setSoapHeader($nameSpace, $name, $data, $mustUnderstand = false,
323320 public function setHttpHeader ($ headerName , $ headerValue )
324321 {
325322 $ state = false ;
326- if (static :: getSoapClient () && !empty ($ headerName )) {
323+ if ($ this -> getSoapClient () && !empty ($ headerName )) {
327324 $ streamContext = $ this ->getStreamContext ();
328325 if ($ streamContext === null ) {
329326 $ options = [];
@@ -361,12 +358,12 @@ public function setHttpHeader($headerName, $headerValue)
361358 * Create context if it does not exist
362359 */
363360 if ($ streamContext === null ) {
364- $ state = (static :: getSoapClient ()->_stream_context = stream_context_create ($ options )) ? true : false ;
361+ $ state = ($ this -> getSoapClient ()->_stream_context = stream_context_create ($ options )) ? true : false ;
365362 } else {
366363 /**
367364 * Set the new context http header option
368365 */
369- $ state = stream_context_set_option (static :: getSoapClient ()->_stream_context , 'http ' , 'header ' , $ options ['http ' ]['header ' ]);
366+ $ state = stream_context_set_option ($ this -> getSoapClient ()->_stream_context , 'http ' , 'header ' , $ options ['http ' ]['header ' ]);
370367 }
371368 }
372369 }
@@ -378,7 +375,7 @@ public function setHttpHeader($headerName, $headerValue)
378375 */
379376 public function getStreamContext ()
380377 {
381- return (static :: getSoapClient () && isset (static :: getSoapClient ()->_stream_context ) && is_resource (static :: getSoapClient ()->_stream_context )) ? static :: getSoapClient ()->_stream_context : null ;
378+ return ($ this -> getSoapClient () && isset ($ this -> getSoapClient ()->_stream_context ) && is_resource ($ this -> getSoapClient ()->_stream_context )) ? $ this -> getSoapClient ()->_stream_context : null ;
382379 }
383380 /**
384381 * Returns current \SoapClient::_stream_context resource options or empty array
0 commit comments