@@ -17,7 +17,7 @@ |
||
17 | 17 | */ |
18 | 18 | public function __construct($message = "", $code = 0, \Exception $previous = null) |
19 | 19 | { |
20 | - $message = 'Invalid XML-response' . (empty($message) ? '' : ': ' . $message); |
|
20 | + $message = 'Invalid XML-response'.(empty($message) ? '' : ': '.$message); |
|
21 | 21 | parent::__construct($message, $code, $previous); |
22 | 22 | } |
23 | 23 | } |
@@ -17,7 +17,7 @@ |
||
17 | 17 | */ |
18 | 18 | public function __construct($message = "", $code = 0, \Exception $previous = null) |
19 | 19 | { |
20 | - $message = 'Invalid response' . (empty($message) ? '' : ': ' . $message); |
|
20 | + $message = 'Invalid response'.(empty($message) ? '' : ': '.$message); |
|
21 | 21 | parent::__construct($message, $code, $previous); |
22 | 22 | } |
23 | 23 | } |
@@ -17,7 +17,7 @@ |
||
17 | 17 | */ |
18 | 18 | public function __construct($message = "", $code = 0, \Exception $previous = null) |
19 | 19 | { |
20 | - $message = 'No reference found' . (empty($message) ? '' : ': ' . $message); |
|
20 | + $message = 'No reference found'.(empty($message) ? '' : ': '.$message); |
|
21 | 21 | parent::__construct($message, $code, $previous); |
22 | 22 | } |
23 | 23 | } |
@@ -17,7 +17,7 @@ |
||
17 | 17 | */ |
18 | 18 | public function __construct($message = "", $code = 0, \Exception $previous = null) |
19 | 19 | { |
20 | - $message = 'Invalid item' . (empty($message) ? '' : ': ' . $message); |
|
20 | + $message = 'Invalid item'.(empty($message) ? '' : ': '.$message); |
|
21 | 21 | parent::__construct($message, $code, $previous); |
22 | 22 | } |
23 | 23 | } |
@@ -17,7 +17,7 @@ |
||
17 | 17 | */ |
18 | 18 | public function __construct($message = "", $code = 0, \Exception $previous = null) |
19 | 19 | { |
20 | - $message = 'No UserId found' . (empty($message) ? '' : ': ' . $message); |
|
20 | + $message = 'No UserId found'.(empty($message) ? '' : ': '.$message); |
|
21 | 21 | parent::__construct($message, $code, $previous); |
22 | 22 | } |
23 | 23 | } |
@@ -17,7 +17,7 @@ |
||
17 | 17 | */ |
18 | 18 | public function __construct($message = "", $code = 0, \Exception $previous = null) |
19 | 19 | { |
20 | - $message = 'Not implemented' . (empty($message) ? '' : ': ' . $message); |
|
20 | + $message = 'Not implemented'.(empty($message) ? '' : ': '.$message); |
|
21 | 21 | parent::__construct($message, $code, $previous); |
22 | 22 | } |
23 | 23 | } |
@@ -102,9 +102,9 @@ discard block |
||
102 | 102 | */ |
103 | 103 | public function __construct($accountId, $passPhrase, $apiUrl = self::API_URL) |
104 | 104 | { |
105 | - $this->accountId = (string)$accountId; |
|
106 | - $this->passPhrase = (string)$passPhrase; |
|
107 | - $this->apiUrl = (string)$apiUrl; |
|
105 | + $this->accountId = (string) $accountId; |
|
106 | + $this->passPhrase = (string) $passPhrase; |
|
107 | + $this->apiUrl = (string) $apiUrl; |
|
108 | 108 | $this->logger = new Logger(); |
109 | 109 | } |
110 | 110 | |
@@ -164,17 +164,17 @@ discard block |
||
164 | 164 | |
165 | 165 | /** @var \SimpleXMLElement $value */ |
166 | 166 | foreach ($item as $key => $value) { |
167 | - $attributes = (array)$value->attributes(); |
|
167 | + $attributes = (array) $value->attributes(); |
|
168 | 168 | |
169 | 169 | if (!empty($attributes) && isset($attributes['@attributes'])) { |
170 | 170 | $return[$key]['@attributes'] = $attributes['@attributes']; |
171 | 171 | } |
172 | 172 | |
173 | 173 | // empty |
174 | - if (isset($value['nil']) && (string)$value['nil'] === 'true') { |
|
174 | + if (isset($value['nil']) && (string) $value['nil'] === 'true') { |
|
175 | 175 | $return[$key] = null; |
176 | 176 | } // empty |
177 | - elseif (isset($value[0]) && (string)$value == '') { |
|
177 | + elseif (isset($value[0]) && (string) $value == '') { |
|
178 | 178 | if (in_array($key, $arrayKeys)) { |
179 | 179 | $return[$key][] = self::decodeResponse($value); |
180 | 180 | } else { |
@@ -183,18 +183,18 @@ discard block |
||
183 | 183 | } else { |
184 | 184 | // arrays |
185 | 185 | if (in_array($key, $arrayKeys)) { |
186 | - $return[$key][] = (string)$value; |
|
186 | + $return[$key][] = (string) $value; |
|
187 | 187 | } // booleans |
188 | - elseif ((string)$value == 'true') { |
|
188 | + elseif ((string) $value == 'true') { |
|
189 | 189 | $return[$key] = true; |
190 | - } elseif ((string)$value == 'false') { |
|
190 | + } elseif ((string) $value == 'false') { |
|
191 | 191 | $return[$key] = false; |
192 | 192 | } // integers |
193 | 193 | elseif (in_array($key, $integerKeys)) { |
194 | - $return[$key] = (int)$value; |
|
194 | + $return[$key] = (int) $value; |
|
195 | 195 | } // fallback to string |
196 | 196 | else { |
197 | - $return[$key] = (string)$value; |
|
197 | + $return[$key] = (string) $value; |
|
198 | 198 | } |
199 | 199 | } |
200 | 200 | } |
@@ -218,16 +218,16 @@ discard block |
||
218 | 218 | private function doCall($url, $body = null, $headers = array(), $method = 'GET', $expectXML = true) |
219 | 219 | { |
220 | 220 | // build Authorization header |
221 | - $headers[] = 'Authorization: Basic ' . $this->getAuthorizationHeader(); |
|
221 | + $headers[] = 'Authorization: Basic '.$this->getAuthorizationHeader(); |
|
222 | 222 | |
223 | 223 | // set options |
224 | - $options[CURLOPT_URL] = $this->apiUrl . '/' . $this->accountId . $url; |
|
224 | + $options[CURLOPT_URL] = $this->apiUrl.'/'.$this->accountId.$url; |
|
225 | 225 | if ($this->getPort() != 0) { |
226 | 226 | $options[CURLOPT_PORT] = $this->getPort(); |
227 | 227 | } |
228 | 228 | $options[CURLOPT_USERAGENT] = $this->getUserAgent(); |
229 | 229 | $options[CURLOPT_RETURNTRANSFER] = true; |
230 | - $options[CURLOPT_TIMEOUT] = (int)$this->getTimeOut(); |
|
230 | + $options[CURLOPT_TIMEOUT] = (int) $this->getTimeOut(); |
|
231 | 231 | $options[CURLOPT_HTTP_VERSION] = CURL_HTTP_VERSION_1_1; |
232 | 232 | $options[CURLOPT_HTTPHEADER] = $headers; |
233 | 233 | |
@@ -251,8 +251,8 @@ discard block |
||
251 | 251 | if ($xml !== false && (substr($xml->getName(), 0, 7) == 'invalid') |
252 | 252 | ) { |
253 | 253 | // message |
254 | - $message = (string)$xml->error; |
|
255 | - $code = isset($xml->code) ? (int)$xml->code : null; |
|
254 | + $message = (string) $xml->error; |
|
255 | + $code = isset($xml->code) ? (int) $xml->code : null; |
|
256 | 256 | |
257 | 257 | // throw exception |
258 | 258 | throw new BpostInvalidSelectionException($message, $code); |
@@ -298,7 +298,7 @@ discard block |
||
298 | 298 | */ |
299 | 299 | private function getAuthorizationHeader() |
300 | 300 | { |
301 | - return base64_encode($this->accountId . ':' . $this->passPhrase); |
|
301 | + return base64_encode($this->accountId.':'.$this->passPhrase); |
|
302 | 302 | } |
303 | 303 | |
304 | 304 | /** |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | */ |
319 | 319 | public function getPort() |
320 | 320 | { |
321 | - return (int)$this->port; |
|
321 | + return (int) $this->port; |
|
322 | 322 | } |
323 | 323 | |
324 | 324 | /** |
@@ -328,7 +328,7 @@ discard block |
||
328 | 328 | */ |
329 | 329 | public function getTimeOut() |
330 | 330 | { |
331 | - return (int)$this->timeOut; |
|
331 | + return (int) $this->timeOut; |
|
332 | 332 | } |
333 | 333 | |
334 | 334 | /** |
@@ -340,7 +340,7 @@ discard block |
||
340 | 340 | */ |
341 | 341 | public function getUserAgent() |
342 | 342 | { |
343 | - return (string)'PHP Bpost/' . self::VERSION . ' ' . $this->userAgent; |
|
343 | + return (string) 'PHP Bpost/'.self::VERSION.' '.$this->userAgent; |
|
344 | 344 | } |
345 | 345 | |
346 | 346 | /** |
@@ -351,7 +351,7 @@ discard block |
||
351 | 351 | */ |
352 | 352 | public function setTimeOut($seconds) |
353 | 353 | { |
354 | - $this->timeOut = (int)$seconds; |
|
354 | + $this->timeOut = (int) $seconds; |
|
355 | 355 | } |
356 | 356 | |
357 | 357 | /** |
@@ -362,7 +362,7 @@ discard block |
||
362 | 362 | */ |
363 | 363 | public function setUserAgent($userAgent) |
364 | 364 | { |
365 | - $this->userAgent = (string)$userAgent; |
|
365 | + $this->userAgent = (string) $userAgent; |
|
366 | 366 | } |
367 | 367 | |
368 | 368 | // webservice methods |
@@ -420,7 +420,7 @@ discard block |
||
420 | 420 | */ |
421 | 421 | public function fetchOrder($reference) |
422 | 422 | { |
423 | - $url = '/orders/' . (string)$reference; |
|
423 | + $url = '/orders/'.(string) $reference; |
|
424 | 424 | |
425 | 425 | $headers = array( |
426 | 426 | 'Accept: application/vnd.bpost.shm-order-v3.3+XML', |
@@ -478,7 +478,7 @@ discard block |
||
478 | 478 | throw new BpostInvalidValueException('status', $status, Box::getPossibleStatusValues()); |
479 | 479 | } |
480 | 480 | |
481 | - $url = '/orders/' . $reference; |
|
481 | + $url = '/orders/'.$reference; |
|
482 | 482 | |
483 | 483 | $document = new \DOMDocument('1.0', 'utf-8'); |
484 | 484 | $document->preserveWhiteSpace = false; |
@@ -542,7 +542,7 @@ discard block |
||
542 | 542 | throw new BpostInvalidValueException('format', $format, self::getPossibleLabelFormatValues()); |
543 | 543 | } |
544 | 544 | |
545 | - $url .= '/labels/' . $format; |
|
545 | + $url .= '/labels/'.$format; |
|
546 | 546 | if ($withReturnLabels) { |
547 | 547 | $url .= '/withReturnLabels'; |
548 | 548 | } |
@@ -586,7 +586,7 @@ discard block |
||
586 | 586 | $withReturnLabels = false, |
587 | 587 | $asPdf = false |
588 | 588 | ) { |
589 | - $url = '/orders/' . (string)$reference; |
|
589 | + $url = '/orders/'.(string) $reference; |
|
590 | 590 | |
591 | 591 | return $this->getLabel($url, $format, $withReturnLabels, $asPdf); |
592 | 592 | } |
@@ -608,7 +608,7 @@ discard block |
||
608 | 608 | $withReturnLabels = false, |
609 | 609 | $asPdf = false |
610 | 610 | ) { |
611 | - $url = '/boxes/' . (string)$barcode; |
|
611 | + $url = '/boxes/'.(string) $barcode; |
|
612 | 612 | |
613 | 613 | return $this->getLabel($url, $format, $withReturnLabels, $asPdf); |
614 | 614 | } |
@@ -80,10 +80,10 @@ discard block |
||
80 | 80 | private function doCall($url, $body = null, $method = 'GET') |
81 | 81 | { |
82 | 82 | // build Authorization header |
83 | - $headers[] = 'Authorization: Basic ' . $this->getAuthorizationHeader(); |
|
83 | + $headers[] = 'Authorization: Basic '.$this->getAuthorizationHeader(); |
|
84 | 84 | |
85 | 85 | // set options |
86 | - $options[CURLOPT_URL] = self::API_URL . $url; |
|
86 | + $options[CURLOPT_URL] = self::API_URL.$url; |
|
87 | 87 | $options[CURLOPT_USERAGENT] = $this->getUserAgent(); |
88 | 88 | $options[CURLOPT_RETURNTRANSFER] = true; |
89 | 89 | $options[CURLOPT_TIMEOUT] = (int) $this->getTimeOut(); |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | */ |
157 | 157 | private function getAuthorizationHeader() |
158 | 158 | { |
159 | - return base64_encode($this->accountId . ':' . $this->passPhrase); |
|
159 | + return base64_encode($this->accountId.':'.$this->passPhrase); |
|
160 | 160 | } |
161 | 161 | |
162 | 162 | /** |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | */ |
190 | 190 | public function getUserAgent() |
191 | 191 | { |
192 | - return (string) 'PHP Bpost Bpack247/' . self::VERSION . ' ' . $this->userAgent; |
|
192 | + return (string) 'PHP Bpost Bpack247/'.self::VERSION.' '.$this->userAgent; |
|
193 | 193 | } |
194 | 194 | |
195 | 195 | /** |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | public function getMember($id) |
262 | 262 | { |
263 | 263 | $xml = $this->doCall( |
264 | - '/customer/' . $id |
|
264 | + '/customer/'.$id |
|
265 | 265 | ); |
266 | 266 | |
267 | 267 | return Customer::createFromXML($xml); |
@@ -138,7 +138,7 @@ |
||
138 | 138 | { |
139 | 139 | $tagName = static::TAG_NAME; |
140 | 140 | if ($prefix !== null) { |
141 | - $tagName = $prefix . ':' . $tagName; |
|
141 | + $tagName = $prefix.':'.$tagName; |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | $customer = $document->createElement($tagName); |