1 | <?php |
||
17 | class SoapClient extends \SoapClient implements SoapClientInterface |
||
18 | { |
||
19 | /** |
||
20 | * @var array |
||
21 | */ |
||
22 | protected $options; |
||
23 | /** |
||
24 | * @var EventDispatcherInterface |
||
25 | */ |
||
26 | protected $dispatcher; |
||
27 | /** |
||
28 | * @var array |
||
29 | */ |
||
30 | private $mockRequests = []; |
||
31 | /** |
||
32 | * @var array |
||
33 | */ |
||
34 | private $mockResponses = []; |
||
35 | |||
36 | /** |
||
37 | * SoapClient constructor. |
||
38 | * @param null $wsdl |
||
39 | * @param array|null $options |
||
40 | */ |
||
41 | 18 | public function __construct($wsdl = null, array $options = []) |
|
42 | { |
||
43 | |||
44 | 18 | if (isset($options['mock_requests'])) { |
|
45 | 12 | $this->setMockRequests($options['mock_requests']); |
|
46 | 12 | unset($options['mock_requests']); |
|
47 | } |
||
48 | 18 | if (isset($options['mock_responses'])) { |
|
49 | 9 | $this->setMockResponses($options['mock_responses']); |
|
50 | 9 | unset($options['mock_responses']); |
|
51 | } |
||
52 | |||
53 | $defaults = array( |
||
54 | 18 | 'compression' => (SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP), |
|
55 | 18 | 'cache_wsdl' => WSDL_CACHE_BOTH, |
|
56 | 18 | 'connection_timeout' => 60, |
|
57 | 'exceptions' => true, |
||
58 | 18 | 'features' => SOAP_SINGLE_ELEMENT_ARRAYS, |
|
59 | 18 | 'soap_version' => SOAP_1_2, |
|
60 | 'trace' => true, |
||
61 | 18 | 'user_agent' => 'freshcells/soap-client-bundle', |
|
62 | ); |
||
63 | |||
64 | 18 | $options = array_merge($defaults, $options); |
|
65 | |||
66 | 18 | $this->SoapClient($wsdl, $options); |
|
67 | 18 | $this->options = $options; |
|
68 | 18 | } |
|
69 | |||
70 | 6 | public function getOptions(): array |
|
71 | { |
||
72 | 6 | return $this->options; |
|
73 | } |
||
74 | |||
75 | 9 | public function __call($function_name, $arguments) |
|
89 | |||
90 | public function __soapCall( |
||
109 | |||
110 | /** |
||
111 | * @param string $request |
||
112 | * @param string $location |
||
113 | * @param string $action |
||
114 | * @param int $version |
||
115 | * @param null $one_way |
||
116 | * @return bool|string |
||
117 | */ |
||
118 | 6 | public function __doRequest($request, $location, $action, $version, $one_way = null) |
|
180 | |||
181 | /** |
||
182 | * Triggered before a request is executed |
||
183 | * |
||
184 | * @param string $id |
||
185 | * @param string $resource |
||
186 | * @param string $requestContent |
||
187 | */ |
||
188 | 6 | protected function preCall(string $id, string $resource, string $requestContent = null) |
|
192 | |||
193 | /** |
||
194 | * @param string $id |
||
195 | * @param string $resource |
||
196 | * @param string $response |
||
197 | */ |
||
198 | 6 | protected function postCall(string $id, string $resource, string $response = null) |
|
210 | |||
211 | /** |
||
212 | * @param string $id |
||
213 | * @param string $resource |
||
214 | * @param string $requestContent |
||
215 | * @param \Exception $exception |
||
216 | */ |
||
217 | 3 | protected function faultCall(string $id, string $resource, string $requestContent, \Exception $exception) |
|
224 | |||
225 | /** |
||
226 | * @param array $mockRequests |
||
227 | */ |
||
228 | 12 | public function setMockRequests(array $mockRequests) |
|
232 | |||
233 | /** |
||
234 | * @param array $mockResponses |
||
235 | */ |
||
236 | 12 | public function setMockResponses(array $mockResponses) |
|
240 | |||
241 | /** |
||
242 | * @param EventDispatcherInterface $dispatcher |
||
243 | * @required |
||
244 | */ |
||
245 | 18 | public function setDispatcher(EventDispatcherInterface $dispatcher) |
|
253 | |||
254 | /** |
||
255 | * @param $function_name |
||
256 | * @param $arguments |
||
257 | * @param $e |
||
258 | */ |
||
259 | 3 | protected function handleFault($function_name, $arguments, $e): void |
|
270 | |||
271 | /** |
||
272 | * @param Event $event |
||
273 | * @param string $eventName |
||
274 | */ |
||
275 | 9 | private function dispatch(Event $event, $eventName) |
|
290 | } |
||
291 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: