@@ -120,7 +120,7 @@ |
||
120 | 120 | |
121 | 121 | // catch generic errors |
122 | 122 | if (isset($xml['type']) && (string) $xml['type'] == 'TaxipostLocatorError') { |
123 | - throw new BpostTaxipostLocatorException((string) $xml->txt, (int)$xml->status); |
|
123 | + throw new BpostTaxipostLocatorException((string) $xml->txt, (int) $xml->status); |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | // return |
@@ -98,9 +98,9 @@ discard block |
||
98 | 98 | */ |
99 | 99 | public function __construct($accountId, $passPhrase, $apiUrl = self::API_URL) |
100 | 100 | { |
101 | - $this->accountId = (string)$accountId; |
|
102 | - $this->passPhrase = (string)$passPhrase; |
|
103 | - $this->apiUrl = (string)$apiUrl; |
|
101 | + $this->accountId = (string) $accountId; |
|
102 | + $this->passPhrase = (string) $passPhrase; |
|
103 | + $this->apiUrl = (string) $apiUrl; |
|
104 | 104 | $this->logger = new Logger(); |
105 | 105 | } |
106 | 106 | |
@@ -141,17 +141,17 @@ discard block |
||
141 | 141 | |
142 | 142 | /** @var \SimpleXMLElement $value */ |
143 | 143 | foreach ($item as $key => $value) { |
144 | - $attributes = (array)$value->attributes(); |
|
144 | + $attributes = (array) $value->attributes(); |
|
145 | 145 | |
146 | 146 | if (!empty($attributes) && isset($attributes['@attributes'])) { |
147 | 147 | $return[$key]['@attributes'] = $attributes['@attributes']; |
148 | 148 | } |
149 | 149 | |
150 | 150 | // empty |
151 | - if (isset($value['nil']) && (string)$value['nil'] === 'true') { |
|
151 | + if (isset($value['nil']) && (string) $value['nil'] === 'true') { |
|
152 | 152 | $return[$key] = null; |
153 | 153 | } // empty |
154 | - elseif (isset($value[0]) && (string)$value == '') { |
|
154 | + elseif (isset($value[0]) && (string) $value == '') { |
|
155 | 155 | if (in_array($key, $arrayKeys)) { |
156 | 156 | $return[$key][] = self::decodeResponse($value); |
157 | 157 | } else { |
@@ -160,18 +160,18 @@ discard block |
||
160 | 160 | } else { |
161 | 161 | // arrays |
162 | 162 | if (in_array($key, $arrayKeys)) { |
163 | - $return[$key][] = (string)$value; |
|
163 | + $return[$key][] = (string) $value; |
|
164 | 164 | } // booleans |
165 | - elseif ((string)$value == 'true') { |
|
165 | + elseif ((string) $value == 'true') { |
|
166 | 166 | $return[$key] = true; |
167 | - } elseif ((string)$value == 'false') { |
|
167 | + } elseif ((string) $value == 'false') { |
|
168 | 168 | $return[$key] = false; |
169 | 169 | } // integers |
170 | 170 | elseif (in_array($key, $integerKeys)) { |
171 | - $return[$key] = (int)$value; |
|
171 | + $return[$key] = (int) $value; |
|
172 | 172 | } // fallback to string |
173 | 173 | else { |
174 | - $return[$key] = (string)$value; |
|
174 | + $return[$key] = (string) $value; |
|
175 | 175 | } |
176 | 176 | } |
177 | 177 | } |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | } |
205 | 205 | $options[CURLOPT_USERAGENT] = $this->getUserAgent(); |
206 | 206 | $options[CURLOPT_RETURNTRANSFER] = true; |
207 | - $options[CURLOPT_TIMEOUT] = (int)$this->getTimeOut(); |
|
207 | + $options[CURLOPT_TIMEOUT] = (int) $this->getTimeOut(); |
|
208 | 208 | $options[CURLOPT_HTTP_VERSION] = CURL_HTTP_VERSION_1_1; |
209 | 209 | $options[CURLOPT_HTTPHEADER] = $headers; |
210 | 210 | |
@@ -249,8 +249,8 @@ discard block |
||
249 | 249 | if ($xml !== false && (substr($xml->getName(), 0, 7) == 'invalid') |
250 | 250 | ) { |
251 | 251 | // message |
252 | - $message = (string)$xml->error; |
|
253 | - $code = isset($xml->code) ? (int)$xml->code : null; |
|
252 | + $message = (string) $xml->error; |
|
253 | + $code = isset($xml->code) ? (int) $xml->code : null; |
|
254 | 254 | |
255 | 255 | // throw exception |
256 | 256 | throw new BpostInvalidSelectionException($message, $code); |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | */ |
317 | 317 | public function getPort() |
318 | 318 | { |
319 | - return (int)$this->port; |
|
319 | + return (int) $this->port; |
|
320 | 320 | } |
321 | 321 | |
322 | 322 | /** |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | */ |
327 | 327 | public function getTimeOut() |
328 | 328 | { |
329 | - return (int)$this->timeOut; |
|
329 | + return (int) $this->timeOut; |
|
330 | 330 | } |
331 | 331 | |
332 | 332 | /** |
@@ -338,7 +338,7 @@ discard block |
||
338 | 338 | */ |
339 | 339 | public function getUserAgent() |
340 | 340 | { |
341 | - return (string)'PHP Bpost/' . self::VERSION . ' ' . $this->userAgent; |
|
341 | + return (string) 'PHP Bpost/' . self::VERSION . ' ' . $this->userAgent; |
|
342 | 342 | } |
343 | 343 | |
344 | 344 | /** |
@@ -349,7 +349,7 @@ discard block |
||
349 | 349 | */ |
350 | 350 | public function setTimeOut($seconds) |
351 | 351 | { |
352 | - $this->timeOut = (int)$seconds; |
|
352 | + $this->timeOut = (int) $seconds; |
|
353 | 353 | } |
354 | 354 | |
355 | 355 | /** |
@@ -360,7 +360,7 @@ discard block |
||
360 | 360 | */ |
361 | 361 | public function setUserAgent($userAgent) |
362 | 362 | { |
363 | - $this->userAgent = (string)$userAgent; |
|
363 | + $this->userAgent = (string) $userAgent; |
|
364 | 364 | } |
365 | 365 | |
366 | 366 | // webservice methods |
@@ -418,7 +418,7 @@ discard block |
||
418 | 418 | */ |
419 | 419 | public function fetchOrder($reference) |
420 | 420 | { |
421 | - $url = '/orders/' . (string)$reference; |
|
421 | + $url = '/orders/' . (string) $reference; |
|
422 | 422 | |
423 | 423 | $headers = array( |
424 | 424 | 'Accept: application/vnd.bpost.shm-order-v3.3+XML', |
@@ -584,7 +584,7 @@ discard block |
||
584 | 584 | $withReturnLabels = false, |
585 | 585 | $asPdf = false |
586 | 586 | ) { |
587 | - $url = '/orders/' . (string)$reference; |
|
587 | + $url = '/orders/' . (string) $reference; |
|
588 | 588 | |
589 | 589 | return $this->getLabel($url, $format, $withReturnLabels, $asPdf); |
590 | 590 | } |
@@ -606,7 +606,7 @@ discard block |
||
606 | 606 | $withReturnLabels = false, |
607 | 607 | $asPdf = false |
608 | 608 | ) { |
609 | - $url = '/boxes/' . (string)$barcode; |
|
609 | + $url = '/boxes/' . (string) $barcode; |
|
610 | 610 | |
611 | 611 | return $this->getLabel($url, $format, $withReturnLabels, $asPdf); |
612 | 612 | } |