1 | <?php |
||
24 | class RemoteAdapter implements RemoteAdapterInterface |
||
25 | { |
||
26 | /** |
||
27 | * @var array |
||
28 | */ |
||
29 | protected static $defaultOptions = array( |
||
30 | 'exceptions' => true, |
||
31 | 'connection_timeout' => 15, |
||
32 | 'keep_alive' => true, |
||
33 | 'compression' => true, |
||
34 | 'features' => SOAP_SINGLE_ELEMENT_ARRAYS, |
||
35 | ); |
||
36 | |||
37 | /** |
||
38 | * @var string |
||
39 | */ |
||
40 | protected $wsdl = null; |
||
41 | |||
42 | /** |
||
43 | * @var string |
||
44 | */ |
||
45 | protected $apiUser = null; |
||
46 | |||
47 | /** |
||
48 | * @var string |
||
49 | */ |
||
50 | protected $apiKey = null; |
||
51 | |||
52 | /** |
||
53 | * @var array |
||
54 | */ |
||
55 | protected $options = null; |
||
56 | |||
57 | /** |
||
58 | * @var boolean |
||
59 | */ |
||
60 | protected $autoLogin = null; |
||
61 | |||
62 | /** |
||
63 | * @var string |
||
64 | */ |
||
65 | protected $sessionId = null; |
||
66 | |||
67 | /** |
||
68 | * @var \SoapClient |
||
69 | */ |
||
70 | protected $soapClient = null; |
||
71 | |||
72 | /** |
||
73 | * @param string $path |
||
74 | * @param string $apiUser |
||
75 | * @param string $apiKey |
||
76 | * @param array $options |
||
77 | * @param bool $autoLogin |
||
78 | */ |
||
79 | public function __construct($path, $apiUser, $apiKey, $options = array(), $autoLogin = true) |
||
89 | |||
90 | /** |
||
91 | * |
||
92 | */ |
||
93 | public function __destruct() |
||
101 | |||
102 | /** |
||
103 | * @return array |
||
104 | */ |
||
105 | public function getOptions() |
||
109 | |||
110 | /** |
||
111 | * @param $options |
||
112 | * |
||
113 | * @return $this |
||
114 | */ |
||
115 | public function setOptions($options) |
||
121 | |||
122 | /** |
||
123 | * @return array |
||
124 | */ |
||
125 | public static function getDefaultOptions() |
||
129 | |||
130 | /** |
||
131 | * @param array $options |
||
132 | */ |
||
133 | public static function setDefaultOptions($options = array()) |
||
137 | |||
138 | /** |
||
139 | * @param string $apiUser |
||
140 | * @param string $apiKey |
||
141 | * |
||
142 | * @return bool |
||
143 | * @throws \Exception |
||
144 | */ |
||
145 | public function login($apiUser = null, $apiKey = null) |
||
161 | |||
162 | /** |
||
163 | * @return bool |
||
164 | */ |
||
165 | public function ping() |
||
171 | |||
172 | /** |
||
173 | * @return bool |
||
174 | */ |
||
175 | public function logout() |
||
186 | |||
187 | /** |
||
188 | * @throws RemoteAdapterException |
||
189 | */ |
||
190 | protected function checkSecurity() |
||
200 | |||
201 | /** |
||
202 | * @param ActionInterface $action |
||
203 | * @param bool $throwsException |
||
204 | * |
||
205 | * @return array|false |
||
206 | * @throws \Exception |
||
207 | */ |
||
208 | public function call(ActionInterface $action, $throwsException = true) |
||
225 | |||
226 | /** |
||
227 | * @param MultiCallQueueInterface $queue |
||
228 | * @param bool $throwsException |
||
229 | * |
||
230 | * @return array|false |
||
231 | * @throws \Exception |
||
232 | */ |
||
233 | public function multiCall(MultiCallQueueInterface $queue, $throwsException = true) |
||
253 | |||
254 | /** |
||
255 | * @param MultiCallQueueInterface $queue |
||
256 | * |
||
257 | * @return array |
||
258 | */ |
||
259 | protected function getActions(MultiCallQueueInterface $queue) |
||
275 | |||
276 | /** |
||
277 | * @param MultiCallQueueInterface $queue |
||
278 | * @param array $results |
||
279 | */ |
||
280 | protected function handleCallbacks(MultiCallQueueInterface $queue, $results) |
||
290 | |||
291 | /** |
||
292 | * @return string |
||
293 | */ |
||
294 | public function getLastRequestHeaders() |
||
298 | |||
299 | /** |
||
300 | * @return string |
||
301 | */ |
||
302 | public function getLastRequest() |
||
306 | |||
307 | /** |
||
308 | * @return string |
||
309 | */ |
||
310 | public function getLastResponseHeaders() |
||
314 | |||
315 | /** |
||
316 | * @return string |
||
317 | */ |
||
318 | public function getLastResponse() |
||
322 | } |
||
323 |
If you suppress an error, we recommend checking for the error condition explicitly: