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 | 21 | public function __construct($wsdl = null, array $options = []) |
|
42 | { |
||
43 | |||
44 | 21 | if (isset($options['mock_requests'])) { |
|
45 | 15 | $this->setMockRequests($options['mock_requests']); |
|
46 | 15 | unset($options['mock_requests']); |
|
47 | } |
||
48 | 21 | if (isset($options['mock_responses'])) { |
|
49 | 12 | $this->setMockResponses($options['mock_responses']); |
|
50 | 12 | unset($options['mock_responses']); |
|
51 | } |
||
52 | |||
53 | $defaults = [ |
||
54 | 21 | 'compression' => (SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP), |
|
55 | 21 | 'cache_wsdl' => WSDL_CACHE_BOTH, |
|
56 | 21 | 'connection_timeout' => 60, |
|
57 | 'exceptions' => true, |
||
58 | 21 | 'features' => SOAP_SINGLE_ELEMENT_ARRAYS, |
|
59 | 21 | 'soap_version' => SOAP_1_2, |
|
60 | 'trace' => true, |
||
61 | 21 | 'user_agent' => 'freshcells/soap-client-bundle', |
|
62 | ]; |
||
63 | |||
64 | 21 | $options = array_merge($defaults, $options); |
|
65 | |||
66 | 21 | $this->SoapClient($wsdl, $options); |
|
67 | 21 | $this->options = $options; |
|
68 | 21 | } |
|
69 | |||
70 | 6 | public function getOptions(): array |
|
71 | { |
||
72 | 6 | return $this->options; |
|
73 | } |
||
74 | |||
75 | 12 | 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) |
|
178 | |||
179 | /** |
||
180 | * Triggered before a request is executed |
||
181 | * |
||
182 | * @param string $id |
||
183 | * @param string $resource |
||
184 | * @param string $requestContent |
||
185 | */ |
||
186 | 6 | protected function preCall(string $id, string $resource, string $requestContent = null) |
|
190 | |||
191 | /** |
||
192 | * @param string $id |
||
193 | * @param string $resource |
||
194 | * @param string $response |
||
195 | */ |
||
196 | 6 | protected function postCall(string $id, string $resource, string $response = null) |
|
208 | |||
209 | /** |
||
210 | * @param string $id |
||
211 | * @param string $resource |
||
212 | * @param string $requestContent |
||
213 | * @param \Exception $exception |
||
214 | */ |
||
215 | 6 | protected function faultCall(string $id, string $resource, string $requestContent, \Exception $exception) |
|
222 | |||
223 | /** |
||
224 | * @param array $mockRequests |
||
225 | */ |
||
226 | 15 | public function setMockRequests(array $mockRequests) |
|
230 | |||
231 | /** |
||
232 | * @param array $mockResponses |
||
233 | */ |
||
234 | 15 | public function setMockResponses(array $mockResponses) |
|
238 | |||
239 | /** |
||
240 | * @param EventDispatcherInterface $dispatcher |
||
241 | * @required |
||
242 | */ |
||
243 | 21 | public function setDispatcher(EventDispatcherInterface $dispatcher) |
|
247 | |||
248 | /** |
||
249 | * @param $function_name |
||
250 | * @param $arguments |
||
251 | * @param $e |
||
252 | */ |
||
253 | 6 | protected function handleFault($function_name, $arguments, $e): void |
|
264 | |||
265 | /** |
||
266 | * @param Event $event |
||
267 | * @param string $eventName |
||
268 | */ |
||
269 | 12 | private function dispatch(Event $event, $eventName) |
|
284 | } |
||
285 |
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: