1 | <?php |
||
25 | abstract class SoapBase implements SoapInterface |
||
26 | { |
||
27 | /** |
||
28 | * @var string |
||
29 | */ |
||
30 | public $responseHead; |
||
31 | /** |
||
32 | * @var string |
||
33 | */ |
||
34 | public $responseBody; |
||
35 | /** |
||
36 | * @var string |
||
37 | */ |
||
38 | public $requestHead; |
||
39 | /** |
||
40 | * @var string |
||
41 | */ |
||
42 | public $requestBody; |
||
43 | /** |
||
44 | * @var string |
||
45 | */ |
||
46 | public $soaperror; |
||
47 | /** |
||
48 | * @var array |
||
49 | */ |
||
50 | public $soapinfo = []; |
||
51 | /** |
||
52 | * @var int |
||
53 | */ |
||
54 | public $waitingTime = 45; |
||
55 | /** |
||
56 | * @var int |
||
57 | */ |
||
58 | protected $soapprotocol = self::SSL_DEFAULT; |
||
59 | /** |
||
60 | * @var int |
||
61 | */ |
||
62 | protected $soaptimeout = 20; |
||
63 | /** |
||
64 | * @var string |
||
65 | */ |
||
66 | protected $proxyIP; |
||
67 | /** |
||
68 | * @var string |
||
69 | */ |
||
70 | protected $proxyPort; |
||
71 | /** |
||
72 | * @var string |
||
73 | */ |
||
74 | protected $proxyUser; |
||
75 | /** |
||
76 | * @var string |
||
77 | */ |
||
78 | protected $proxyPass; |
||
79 | /** |
||
80 | * @var array |
||
81 | */ |
||
82 | protected $prefixes = [1 => 'soapenv', 2 => 'soap']; |
||
83 | /** |
||
84 | * @var Certificate |
||
85 | */ |
||
86 | protected $certificate; |
||
87 | /** |
||
88 | * @var LoggerInterface |
||
89 | */ |
||
90 | protected $logger; |
||
91 | /** |
||
92 | * @var string |
||
93 | */ |
||
94 | protected $tempdir; |
||
95 | /** |
||
96 | * @var string |
||
97 | */ |
||
98 | protected $certsdir; |
||
99 | /** |
||
100 | * @var string |
||
101 | */ |
||
102 | protected $debugdir; |
||
103 | /** |
||
104 | * @var string |
||
105 | */ |
||
106 | protected $prifile; |
||
107 | /** |
||
108 | * @var string |
||
109 | */ |
||
110 | protected $pubfile; |
||
111 | /** |
||
112 | * @var string |
||
113 | */ |
||
114 | protected $certfile; |
||
115 | /** |
||
116 | * @var string |
||
117 | */ |
||
118 | protected $casefaz; |
||
119 | /** |
||
120 | * @var bool |
||
121 | */ |
||
122 | protected $disablesec = false; |
||
123 | /** |
||
124 | * @var bool |
||
125 | */ |
||
126 | protected $disableCertValidation = false; |
||
127 | /** |
||
128 | * @var \League\Flysystem\Adapter\Local |
||
129 | */ |
||
130 | protected $adapter; |
||
131 | /** |
||
132 | * @var \League\Flysystem\Filesystem |
||
133 | */ |
||
134 | protected $filesystem; |
||
135 | /** |
||
136 | * @var string |
||
137 | */ |
||
138 | protected $temppass = ''; |
||
139 | /** |
||
140 | * @var bool |
||
141 | */ |
||
142 | protected $encriptPrivateKey = true; |
||
143 | /** |
||
144 | * @var bool |
||
145 | */ |
||
146 | protected $debugmode = false; |
||
147 | /** |
||
148 | * Constructor |
||
149 | * |
||
150 | * @param Certificate $certificate |
||
151 | * @param LoggerInterface $logger |
||
152 | */ |
||
153 | public function __construct( |
||
161 | /** |
||
162 | * Check if certificate is valid |
||
163 | * |
||
164 | * @param Certificate $certificate |
||
165 | * |
||
166 | * @return Certificate |
||
167 | * @throws RuntimeException |
||
168 | */ |
||
169 | private function checkCertValidity(Certificate $certificate = null) |
||
183 | /** |
||
184 | * Set another temporayfolder for saving certificates for SOAP utilization |
||
185 | * |
||
186 | * @param string $folderRealPath |
||
187 | */ |
||
188 | public function setTemporaryFolder($folderRealPath) |
||
193 | /** |
||
194 | * Set Local folder for flysystem |
||
195 | * |
||
196 | * @param string $folder |
||
197 | */ |
||
198 | protected function setLocalFolder($folder = '') |
||
203 | /** |
||
204 | * Destructor |
||
205 | * Clean temporary files |
||
206 | */ |
||
207 | public function __destruct() |
||
211 | /** |
||
212 | * Delete all files in folder |
||
213 | */ |
||
214 | public function removeTemporarilyFiles() |
||
248 | /** |
||
249 | * Disables the security checking of host and peer certificates |
||
250 | * |
||
251 | * @param bool $flag |
||
252 | */ |
||
253 | public function disableSecurity($flag = false) |
||
258 | /** |
||
259 | * ONlY for tests |
||
260 | * |
||
261 | * @param bool $flag |
||
262 | * |
||
263 | * @return bool |
||
264 | */ |
||
265 | public function disableCertValidation($flag = true) |
||
270 | /** |
||
271 | * Load path to CA and enable to use on SOAP |
||
272 | * |
||
273 | * @param string $capath |
||
274 | */ |
||
275 | public function loadCA($capath) |
||
281 | /** |
||
282 | * Set option to encript private key before save in filesystem |
||
283 | * for an additional layer of protection |
||
284 | * |
||
285 | * @param bool $encript |
||
286 | * |
||
287 | * @return bool |
||
288 | */ |
||
289 | public function setEncriptPrivateKey($encript = true) |
||
293 | /** |
||
294 | * Set debug mode, this mode will save soap envelopes in temporary directory |
||
295 | * |
||
296 | * @param bool $value |
||
297 | * |
||
298 | * @return bool |
||
299 | */ |
||
300 | public function setDebugMode($value = false) |
||
304 | /** |
||
305 | * Set certificate class for SSL comunications |
||
306 | * |
||
307 | * @param Certificate $certificate |
||
308 | */ |
||
309 | public function loadCertificate(Certificate $certificate) |
||
313 | /** |
||
314 | * Set logger class |
||
315 | * |
||
316 | * @param LoggerInterface $logger |
||
317 | */ |
||
318 | public function loadLogger(LoggerInterface $logger) |
||
322 | /** |
||
323 | * Set timeout for communication |
||
324 | * |
||
325 | * @param int $timesecs |
||
326 | */ |
||
327 | public function timeout($timesecs) |
||
331 | /** |
||
332 | * Set security protocol |
||
333 | * |
||
334 | * @param int $protocol |
||
335 | * |
||
336 | * @return type Description |
||
337 | */ |
||
338 | public function protocol($protocol = self::SSL_DEFAULT) |
||
342 | /** |
||
343 | * Set prefixes |
||
344 | * |
||
345 | * @param string $prefixes |
||
346 | * |
||
347 | * @return string |
||
348 | */ |
||
349 | public function setSoapPrefix($prefixes) |
||
353 | /** |
||
354 | * Set proxy parameters |
||
355 | * |
||
356 | * @param string $ip |
||
357 | * @param int $port |
||
358 | * @param string $user |
||
359 | * @param string $password |
||
360 | */ |
||
361 | public function proxy($ip, $port, $user, $password) |
||
368 | /** |
||
369 | * Send message to webservice |
||
370 | */ |
||
371 | abstract public function send( |
||
378 | /** |
||
379 | * Temporarily saves the certificate keys for use cURL or SoapClient |
||
380 | */ |
||
381 | public function saveTemporarilyKeyFiles() |
||
424 | /** |
||
425 | * Save request envelope and response for debug reasons |
||
426 | * |
||
427 | * @param string $operation |
||
428 | * @param string $request |
||
429 | * @param string $response |
||
430 | * |
||
431 | * @return void |
||
432 | */ |
||
433 | public function saveDebugFiles($operation, $request, $response) |
||
456 | /** |
||
457 | * Mount soap envelope |
||
458 | * |
||
459 | * @param string $request |
||
460 | * @param array $namespaces |
||
461 | * @param \SOAPHeader $header |
||
462 | * |
||
463 | * @return string |
||
464 | */ |
||
465 | protected function makeEnvelopeSoap( |
||
493 | } |
This check looks for assignments to scalar types that may be of the wrong type.
To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.