@@ -12,7 +12,7 @@ |
||
12 | 12 | */ |
13 | 13 | public static function getPrefixedTagName(string $tagName, ?string $prefix = null): string |
14 | 14 | { |
15 | - return empty($prefix) ? $tagName : $prefix . ':' . $tagName; |
|
15 | + return empty($prefix) ? $tagName : $prefix.':'.$tagName; |
|
16 | 16 | } |
17 | 17 | |
18 | 18 | /** |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | |
39 | 39 | public function __toString(): string |
40 | 40 | { |
41 | - return (string)$this->getValue(); |
|
41 | + return (string) $this->getValue(); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | /** |
@@ -46,8 +46,8 @@ discard block |
||
46 | 46 | */ |
47 | 47 | public function validateLength(int $length): void |
48 | 48 | { |
49 | - if (mb_strlen((string)$this->getValue()) > $length) { |
|
50 | - throw new BpostInvalidLengthException('', mb_strlen((string)$this->getValue()), $length); |
|
49 | + if (mb_strlen((string) $this->getValue()) > $length) { |
|
50 | + throw new BpostInvalidLengthException('', mb_strlen((string) $this->getValue()), $length); |
|
51 | 51 | } |
52 | 52 | } |
53 | 53 | |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | */ |
67 | 67 | public function validatePattern(string $regexPattern): void |
68 | 68 | { |
69 | - if (!preg_match("/^$regexPattern\$/", (string)$this->getValue())) { |
|
69 | + if (!preg_match("/^$regexPattern\$/", (string) $this->getValue())) { |
|
70 | 70 | throw new BpostInvalidPatternException('', $this->getValue(), $regexPattern); |
71 | 71 | } |
72 | 72 | } |
@@ -61,11 +61,11 @@ discard block |
||
61 | 61 | private function doCall(string $url, ?string $body = null, string $method = 'GET'): SimpleXMLElement |
62 | 62 | { |
63 | 63 | $headers = [ |
64 | - 'Authorization: Basic ' . $this->getAuthorizationHeader(), |
|
64 | + 'Authorization: Basic '.$this->getAuthorizationHeader(), |
|
65 | 65 | ]; |
66 | 66 | |
67 | 67 | $options = [ |
68 | - CURLOPT_URL => self::API_URL . $url, |
|
68 | + CURLOPT_URL => self::API_URL.$url, |
|
69 | 69 | CURLOPT_USERAGENT => $this->getUserAgent(), |
70 | 70 | CURLOPT_RETURNTRANSFER => true, |
71 | 71 | CURLOPT_TIMEOUT => $this->getTimeOut(), |
@@ -96,11 +96,11 @@ discard block |
||
96 | 96 | throw new BpostCurlException($errorMessage, $errorNumber); |
97 | 97 | } |
98 | 98 | |
99 | - $httpCode = (int)($info['http_code'] ?? 0); |
|
99 | + $httpCode = (int) ($info['http_code'] ?? 0); |
|
100 | 100 | |
101 | 101 | // Non 200 => tenter de parser l'erreur métier pour renvoyer l’exception dédiée |
102 | 102 | if (!in_array($httpCode, [0, 200], true)) { |
103 | - $xml = @simplexml_load_string((string)$response); |
|
103 | + $xml = @simplexml_load_string((string) $response); |
|
104 | 104 | |
105 | 105 | if ( |
106 | 106 | $xml !== false |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | } |
120 | 120 | |
121 | 121 | // 200: parser XML |
122 | - $xml = simplexml_load_string((string)$response); |
|
122 | + $xml = simplexml_load_string((string) $response); |
|
123 | 123 | if ($xml === false) { |
124 | 124 | // pas de XML valide alors que 200 => considérer comme réponse invalide |
125 | 125 | throw new BpostInvalidResponseException('Empty or invalid XML body', 200); |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | */ |
146 | 146 | private function getAuthorizationHeader(): string |
147 | 147 | { |
148 | - return base64_encode($this->accountId . ':' . $this->passPhrase); |
|
148 | + return base64_encode($this->accountId.':'.$this->passPhrase); |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | /** |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | public function getUserAgent(): string |
172 | 172 | { |
173 | 173 | $extra = trim($this->userAgent); |
174 | - return sprintf('PHP Bpost Bpack247/%s%s', self::VERSION, $extra !== '' ? ' ' . $extra : ''); |
|
174 | + return sprintf('PHP Bpost Bpack247/%s%s', self::VERSION, $extra !== '' ? ' '.$extra : ''); |
|
175 | 175 | } |
176 | 176 | |
177 | 177 | /** |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | */ |
214 | 214 | public function getMember(string $id): Customer |
215 | 215 | { |
216 | - $xml = $this->doCall('/customer/' . $id); |
|
216 | + $xml = $this->doCall('/customer/'.$id); |
|
217 | 217 | return Customer::createFromXML($xml); |
218 | 218 | } |
219 | 219 | } |
220 | 220 | \ No newline at end of file |
@@ -91,7 +91,7 @@ |
||
91 | 91 | */ |
92 | 92 | public function output() |
93 | 93 | { |
94 | - header('Content-type: ' . $this->getMimeType()); |
|
94 | + header('Content-type: '.$this->getMimeType()); |
|
95 | 95 | echo $this->getBytes(); |
96 | 96 | exit; |
97 | 97 | } |
@@ -11,7 +11,7 @@ |
||
11 | 11 | public const VISIBLE = 'VISIBLE'; |
12 | 12 | public const NOT_VISIBLE_BY_CONSUMER_OPTIONAL = 'NOT_VISIBLE_BY_CONSUMER_OPTIONAL'; |
13 | 13 | public const NOT_VISIBLE_BY_CONSUMER_DEFAULT = 'NOT_VISIBLE_BY_CONSUMER_DEFAULT'; |
14 | - public const VISIBLE_BY_CONSUMER_AND_MANDATORY= 'VISIBLE_BY_CONSUMER_AND_MANDATORY'; |
|
14 | + public const VISIBLE_BY_CONSUMER_AND_MANDATORY = 'VISIBLE_BY_CONSUMER_AND_MANDATORY'; |
|
15 | 15 | public const DELIVERY_METHOD_VISIBILITY_VISIBLE = 'VISIBLE'; |
16 | 16 | public const DELIVERY_METHOD_VISIBILITY_GREYED_OUT = 'GREYED_OUT'; |
17 | 17 | public const DELIVERY_METHOD_VISIBILITY_INVISIBLE = 'INVISIBLE'; |
@@ -22,7 +22,7 @@ |
||
22 | 22 | public const PRODUCT_NAME_BPACK_WORLD_EXPRESS_PRO = 'bpack World Express Pro'; |
23 | 23 | public const PRODUCT_NAME_BPACK_WORLD_BUSINESS = 'bpack World Business'; |
24 | 24 | public const PRODUCT_NAME_BPACK_EUROPE_BUSINESS = 'bpack Europe Business'; |
25 | - public const PRODUCT_NAME_BPACK_AT_BPOST_INTERNATIONAL= 'bpack@bpost international'; |
|
25 | + public const PRODUCT_NAME_BPACK_AT_BPOST_INTERNATIONAL = 'bpack@bpost international'; |
|
26 | 26 | |
27 | 27 | private bool $default; |
28 | 28 | private string $name; |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | if ($classNameExtracted === 'at24-7') { |
172 | 172 | $classNameExtracted = 'at247'; |
173 | 173 | } |
174 | - $className = '\\Bpost\\BpostApiClient\\Bpost\\Order\\Box\\' . ucfirst((string)$classNameExtracted); |
|
174 | + $className = '\\Bpost\\BpostApiClient\\Bpost\\Order\\Box\\'.ucfirst((string) $classNameExtracted); |
|
175 | 175 | XmlHelper::assertMethodCreateFromXmlExists($className); |
176 | 176 | |
177 | 177 | /** @var National $nationalBox */ |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | if ($classNameExtracted === 'atIntlHome') { |
186 | 186 | $classNameExtracted = 'international'; |
187 | 187 | } |
188 | - $className = '\\Bpost\\BpostApiClient\\Bpost\\Order\\Box\\' . ucfirst((string)$classNameExtracted); |
|
188 | + $className = '\\Bpost\\BpostApiClient\\Bpost\\Order\\Box\\'.ucfirst((string) $classNameExtracted); |
|
189 | 189 | XmlHelper::assertMethodCreateFromXmlExists($className); |
190 | 190 | |
191 | 191 | /** @var International $internationalBox */ |
@@ -194,16 +194,16 @@ discard block |
||
194 | 194 | } |
195 | 195 | |
196 | 196 | if (isset($xml->remark) && (string) $xml->remark !== '') { |
197 | - $box->setRemark((string)$xml->remark); |
|
197 | + $box->setRemark((string) $xml->remark); |
|
198 | 198 | } |
199 | 199 | if (isset($xml->additionalCustomerReference) && (string) $xml->additionalCustomerReference !== '') { |
200 | - $box->setAdditionalCustomerReference((string)$xml->additionalCustomerReference); |
|
200 | + $box->setAdditionalCustomerReference((string) $xml->additionalCustomerReference); |
|
201 | 201 | } |
202 | 202 | if (!empty($xml->barcode)) { |
203 | - $box->setBarcode((string)$xml->barcode); |
|
203 | + $box->setBarcode((string) $xml->barcode); |
|
204 | 204 | } |
205 | 205 | if (isset($xml->status) && (string) $xml->status !== '') { |
206 | - $box->setStatus((string)$xml->status); |
|
206 | + $box->setStatus((string) $xml->status); |
|
207 | 207 | } |
208 | 208 | |
209 | 209 | return $box; |
@@ -170,25 +170,25 @@ |
||
170 | 170 | { |
171 | 171 | $parcelContent = new self(); |
172 | 172 | |
173 | - if (isset($xml->numberOfItemType) && (string)$xml->numberOfItemType !== '') { |
|
174 | - $parcelContent->setNumberOfItemType((int)$xml->numberOfItemType); |
|
173 | + if (isset($xml->numberOfItemType) && (string) $xml->numberOfItemType !== '') { |
|
174 | + $parcelContent->setNumberOfItemType((int) $xml->numberOfItemType); |
|
175 | 175 | } |
176 | - if (isset($xml->valueOfItem) && (string)$xml->valueOfItem !== '') { |
|
176 | + if (isset($xml->valueOfItem) && (string) $xml->valueOfItem !== '') { |
|
177 | 177 | // XML porte des cents → int |
178 | - $parcelContent->setValueOfItem((int)$xml->valueOfItem); |
|
178 | + $parcelContent->setValueOfItem((int) $xml->valueOfItem); |
|
179 | 179 | } |
180 | - if (isset($xml->itemDescription) && (string)$xml->itemDescription !== '') { |
|
181 | - $parcelContent->setItemDescription((string)$xml->itemDescription); |
|
180 | + if (isset($xml->itemDescription) && (string) $xml->itemDescription !== '') { |
|
181 | + $parcelContent->setItemDescription((string) $xml->itemDescription); |
|
182 | 182 | } |
183 | - if (isset($xml->nettoWeight) && (string)$xml->nettoWeight !== '') { |
|
184 | - $parcelContent->setNettoWeight((int)$xml->nettoWeight); |
|
183 | + if (isset($xml->nettoWeight) && (string) $xml->nettoWeight !== '') { |
|
184 | + $parcelContent->setNettoWeight((int) $xml->nettoWeight); |
|
185 | 185 | } |
186 | - if (isset($xml->hsTariffCode) && (string)$xml->hsTariffCode !== '') { |
|
186 | + if (isset($xml->hsTariffCode) && (string) $xml->hsTariffCode !== '') { |
|
187 | 187 | // FIX: garder en string (pas (int)) |
188 | - $parcelContent->setHsTariffCode((string)$xml->hsTariffCode); |
|
188 | + $parcelContent->setHsTariffCode((string) $xml->hsTariffCode); |
|
189 | 189 | } |
190 | - if (isset($xml->originOfGoods) && (string)$xml->originOfGoods !== '') { |
|
191 | - $parcelContent->setOriginOfGoods((string)$xml->originOfGoods); |
|
190 | + if (isset($xml->originOfGoods) && (string) $xml->originOfGoods !== '') { |
|
191 | + $parcelContent->setOriginOfGoods((string) $xml->originOfGoods); |
|
192 | 192 | } |
193 | 193 | |
194 | 194 | return $parcelContent; |
@@ -119,8 +119,8 @@ |
||
119 | 119 | ); |
120 | 120 | } |
121 | 121 | |
122 | - if (isset($atHomeXml->requestedDeliveryDate) && (string)$atHomeXml->requestedDeliveryDate !== '') { |
|
123 | - $self->setRequestedDeliveryDate((string)$atHomeXml->requestedDeliveryDate); |
|
122 | + if (isset($atHomeXml->requestedDeliveryDate) && (string) $atHomeXml->requestedDeliveryDate !== '') { |
|
123 | + $self->setRequestedDeliveryDate((string) $atHomeXml->requestedDeliveryDate); |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | return $self; |