@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | 'orderWeight', |
43 | 43 | ]; |
44 | 44 | |
45 | - $base = 'accountId=' . $this->bpost->getAccountId() . '&'; |
|
45 | + $base = 'accountId='.$this->bpost->getAccountId().'&'; |
|
46 | 46 | |
47 | 47 | foreach ($keysToHash as $key) { |
48 | 48 | if (!array_key_exists($key, $this->parameters)) { |
@@ -52,13 +52,13 @@ discard block |
||
52 | 52 | $value = $this->parameters[$key]; |
53 | 53 | |
54 | 54 | if (!is_array($value)) { |
55 | - $base .= $key . '=' . $value . '&'; |
|
55 | + $base .= $key.'='.$value.'&'; |
|
56 | 56 | continue; |
57 | 57 | } |
58 | 58 | |
59 | 59 | // Si c’est un tableau, concaténer chaque entrée (tri déjà fait dans setParameter) |
60 | 60 | foreach ($value as $entry) { |
61 | - $base .= $key . '=' . $entry . '&'; |
|
61 | + $base .= $key.'='.$entry.'&'; |
|
62 | 62 | } |
63 | 63 | } |
64 | 64 | |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | |
80 | 80 | if ($form && isset($return['orderLine']) && is_array($return['orderLine'])) { |
81 | 81 | foreach ($return['orderLine'] as $key => $value) { |
82 | - $return['orderLine[' . $key . ']'] = $value; |
|
82 | + $return['orderLine['.$key.']'] = $value; |
|
83 | 83 | } |
84 | 84 | unset($return['orderLine']); |
85 | 85 | } |
@@ -231,32 +231,32 @@ discard block |
||
231 | 231 | $poi = new self(); |
232 | 232 | |
233 | 233 | // Identifiants / type / nom |
234 | - if (isset($recordXml->Id) && (string)$recordXml->Id !== '') { $poi->setId((string)$recordXml->Id); } |
|
235 | - if (isset($recordXml->ID) && (string)$recordXml->ID !== '') { $poi->setId((string)$recordXml->ID); } |
|
234 | + if (isset($recordXml->Id) && (string) $recordXml->Id !== '') { $poi->setId((string) $recordXml->Id); } |
|
235 | + if (isset($recordXml->ID) && (string) $recordXml->ID !== '') { $poi->setId((string) $recordXml->ID); } |
|
236 | 236 | |
237 | - if (isset($recordXml->Type) && (string)$recordXml->Type !== '') { $poi->setType((string)$recordXml->Type); } |
|
237 | + if (isset($recordXml->Type) && (string) $recordXml->Type !== '') { $poi->setType((string) $recordXml->Type); } |
|
238 | 238 | |
239 | - if (isset($recordXml->Name) && (string)$recordXml->Name !== '') { $poi->setOffice((string)$recordXml->Name); } |
|
240 | - if (isset($recordXml->OFFICE) && (string)$recordXml->OFFICE !== '') { $poi->setOffice((string)$recordXml->OFFICE); } |
|
239 | + if (isset($recordXml->Name) && (string) $recordXml->Name !== '') { $poi->setOffice((string) $recordXml->Name); } |
|
240 | + if (isset($recordXml->OFFICE) && (string) $recordXml->OFFICE !== '') { $poi->setOffice((string) $recordXml->OFFICE); } |
|
241 | 241 | |
242 | 242 | // Adresse |
243 | - if (isset($recordXml->Street) && (string)$recordXml->Street !== '') { $poi->setStreet((string)$recordXml->Street); } |
|
244 | - if (isset($recordXml->STREET) && (string)$recordXml->STREET !== '') { $poi->setStreet((string)$recordXml->STREET); } |
|
243 | + if (isset($recordXml->Street) && (string) $recordXml->Street !== '') { $poi->setStreet((string) $recordXml->Street); } |
|
244 | + if (isset($recordXml->STREET) && (string) $recordXml->STREET !== '') { $poi->setStreet((string) $recordXml->STREET); } |
|
245 | 245 | |
246 | - if (isset($recordXml->Number) && (string)$recordXml->Number !== '') { $poi->setNr((string)$recordXml->Number); } |
|
247 | - if (isset($recordXml->NR) && (string)$recordXml->NR !== '') { $poi->setNr((string)$recordXml->NR); } |
|
246 | + if (isset($recordXml->Number) && (string) $recordXml->Number !== '') { $poi->setNr((string) $recordXml->Number); } |
|
247 | + if (isset($recordXml->NR) && (string) $recordXml->NR !== '') { $poi->setNr((string) $recordXml->NR); } |
|
248 | 248 | |
249 | - if (isset($recordXml->Zip) && (string)$recordXml->Zip !== '') { $poi->setZip((string)$recordXml->Zip); } |
|
250 | - if (isset($recordXml->ZIP) && (string)$recordXml->ZIP !== '') { $poi->setZip((string)$recordXml->ZIP); } |
|
249 | + if (isset($recordXml->Zip) && (string) $recordXml->Zip !== '') { $poi->setZip((string) $recordXml->Zip); } |
|
250 | + if (isset($recordXml->ZIP) && (string) $recordXml->ZIP !== '') { $poi->setZip((string) $recordXml->ZIP); } |
|
251 | 251 | |
252 | - if (isset($recordXml->City) && (string)$recordXml->City !== '') { $poi->setCity((string)$recordXml->City); } |
|
253 | - if (isset($recordXml->CITY) && (string)$recordXml->CITY !== '') { $poi->setCity((string)$recordXml->CITY); } |
|
252 | + if (isset($recordXml->City) && (string) $recordXml->City !== '') { $poi->setCity((string) $recordXml->City); } |
|
253 | + if (isset($recordXml->CITY) && (string) $recordXml->CITY !== '') { $poi->setCity((string) $recordXml->CITY); } |
|
254 | 254 | |
255 | 255 | // Coordonnées |
256 | - if (isset($recordXml->X) && (string)$recordXml->X !== '') { $poi->setX((int)$recordXml->X); } |
|
257 | - if (isset($recordXml->Y) && (string)$recordXml->Y !== '') { $poi->setY((int)$recordXml->Y); } |
|
258 | - if (isset($recordXml->Longitude) && (string)$recordXml->Longitude !== '') { $poi->setLongitude((float)$recordXml->Longitude); } |
|
259 | - if (isset($recordXml->Latitude) && (string)$recordXml->Latitude !== '') { $poi->setLatitude((float)$recordXml->Latitude); } |
|
256 | + if (isset($recordXml->X) && (string) $recordXml->X !== '') { $poi->setX((int) $recordXml->X); } |
|
257 | + if (isset($recordXml->Y) && (string) $recordXml->Y !== '') { $poi->setY((int) $recordXml->Y); } |
|
258 | + if (isset($recordXml->Longitude) && (string) $recordXml->Longitude !== '') { $poi->setLongitude((float) $recordXml->Longitude); } |
|
259 | + if (isset($recordXml->Latitude) && (string) $recordXml->Latitude !== '') { $poi->setLatitude((float) $recordXml->Latitude); } |
|
260 | 260 | |
261 | 261 | // Services |
262 | 262 | if (isset($recordXml->Services) && isset($recordXml->Services->Service)) { |
@@ -268,24 +268,24 @@ discard block |
||
268 | 268 | if (isset($recordXml->Hours)) { |
269 | 269 | $hours = $recordXml->Hours; |
270 | 270 | |
271 | - if (isset($hours->Monday)) { $poi->addHour(Day::DAY_INDEX_MONDAY, Day::createFromXML($hours->Monday)); } |
|
272 | - if (isset($hours->Tuesday)) { $poi->addHour(Day::DAY_INDEX_TUESDAY, Day::createFromXML($hours->Tuesday)); } |
|
271 | + if (isset($hours->Monday)) { $poi->addHour(Day::DAY_INDEX_MONDAY, Day::createFromXML($hours->Monday)); } |
|
272 | + if (isset($hours->Tuesday)) { $poi->addHour(Day::DAY_INDEX_TUESDAY, Day::createFromXML($hours->Tuesday)); } |
|
273 | 273 | if (isset($hours->Wednesday)) { $poi->addHour(Day::DAY_INDEX_WEDNESDAY, Day::createFromXML($hours->Wednesday)); } |
274 | - if (isset($hours->Thursday)) { $poi->addHour(Day::DAY_INDEX_THURSDAY, Day::createFromXML($hours->Thursday)); } |
|
275 | - if (isset($hours->Friday)) { $poi->addHour(Day::DAY_INDEX_FRIDAY, Day::createFromXML($hours->Friday)); } |
|
276 | - if (isset($hours->Saturday)) { $poi->addHour(Day::DAY_INDEX_SATURDAY, Day::createFromXML($hours->Saturday)); } |
|
277 | - if (isset($hours->Sunday)) { $poi->addHour(Day::DAY_INDEX_SUNDAY, Day::createFromXML($hours->Sunday)); } |
|
274 | + if (isset($hours->Thursday)) { $poi->addHour(Day::DAY_INDEX_THURSDAY, Day::createFromXML($hours->Thursday)); } |
|
275 | + if (isset($hours->Friday)) { $poi->addHour(Day::DAY_INDEX_FRIDAY, Day::createFromXML($hours->Friday)); } |
|
276 | + if (isset($hours->Saturday)) { $poi->addHour(Day::DAY_INDEX_SATURDAY, Day::createFromXML($hours->Saturday)); } |
|
277 | + if (isset($hours->Sunday)) { $poi->addHour(Day::DAY_INDEX_SUNDAY, Day::createFromXML($hours->Sunday)); } |
|
278 | 278 | } |
279 | 279 | |
280 | - if (isset($recordXml->ClosedFrom) && (string)$recordXml->ClosedFrom !== '') { $poi->setClosedFrom((string)$recordXml->ClosedFrom); } |
|
281 | - if (isset($recordXml->ClosedTo) && (string)$recordXml->ClosedTo !== '') { $poi->setClosedTo((string)$recordXml->ClosedTo); } |
|
280 | + if (isset($recordXml->ClosedFrom) && (string) $recordXml->ClosedFrom !== '') { $poi->setClosedFrom((string) $recordXml->ClosedFrom); } |
|
281 | + if (isset($recordXml->ClosedTo) && (string) $recordXml->ClosedTo !== '') { $poi->setClosedTo((string) $recordXml->ClosedTo); } |
|
282 | 282 | |
283 | 283 | // Note |
284 | - if (isset($recordXml->NOTE) && (string)$recordXml->NOTE !== '') { $poi->setNote((string)$recordXml->NOTE); } |
|
284 | + if (isset($recordXml->NOTE) && (string) $recordXml->NOTE !== '') { $poi->setNote((string) $recordXml->NOTE); } |
|
285 | 285 | |
286 | 286 | // Lien page |
287 | - if (isset($xml->Page) && isset($xml->Page['ServiceRef']) && (string)$xml->Page['ServiceRef'] !== '') { |
|
288 | - $poi->setPage((string)$xml->Page['ServiceRef']); |
|
287 | + if (isset($xml->Page) && isset($xml->Page['ServiceRef']) && (string) $xml->Page['ServiceRef'] !== '') { |
|
288 | + $poi->setPage((string) $xml->Page['ServiceRef']); |
|
289 | 289 | } |
290 | 290 | |
291 | 291 | return $poi; |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | */ |
85 | 85 | private static function decodeResponse(SimpleXMLElement $item, ?array $return = null, int $i = 0): array |
86 | 86 | { |
87 | - $arrayKeys = [ |
|
87 | + $arrayKeys = [ |
|
88 | 88 | 'barcode', |
89 | 89 | 'orderLine', |
90 | 90 | Insured::INSURANCE_TYPE_ADDITIONAL_INSURANCE, |
@@ -133,13 +133,13 @@ discard block |
||
133 | 133 | * @throws BpostInvalidSelectionException |
134 | 134 | * @throws BpostInvalidXmlResponseException |
135 | 135 | */ |
136 | - private function doCall(HttpRequestBuilderInterface $builder): string|SimpleXMLElement |
|
136 | + private function doCall(HttpRequestBuilderInterface $builder): string | SimpleXMLElement |
|
137 | 137 | { |
138 | 138 | $headers = $builder->getHeaders(); |
139 | - $headers[] = 'Authorization: Basic ' . $this->getAuthorizationHeader(); |
|
139 | + $headers[] = 'Authorization: Basic '.$this->getAuthorizationHeader(); |
|
140 | 140 | |
141 | 141 | $options = [ |
142 | - CURLOPT_URL => rtrim($this->apiUrl, '/') . '/' . rawurlencode($this->accountId) . $builder->getUrl(), |
|
142 | + CURLOPT_URL => rtrim($this->apiUrl, '/').'/'.rawurlencode($this->accountId).$builder->getUrl(), |
|
143 | 143 | CURLOPT_USERAGENT => $this->getUserAgent(), |
144 | 144 | CURLOPT_RETURNTRANSFER => true, |
145 | 145 | CURLOPT_TIMEOUT => $this->getTimeOut(), |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | |
198 | 198 | private function getAuthorizationHeader(): string |
199 | 199 | { |
200 | - return base64_encode($this->accountId . ':' . $this->passPhrase); |
|
200 | + return base64_encode($this->accountId.':'.$this->passPhrase); |
|
201 | 201 | } |
202 | 202 | |
203 | 203 | public function getPassPhrase(): string |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | |
218 | 218 | public function getUserAgent(): string |
219 | 219 | { |
220 | - return 'PHP Bpost/' . self::VERSION . ' ' . ($this->userAgent ?? ''); |
|
220 | + return 'PHP Bpost/'.self::VERSION.' '.($this->userAgent ?? ''); |
|
221 | 221 | } |
222 | 222 | |
223 | 223 | public function setTimeOut(int $seconds): void |
@@ -52,14 +52,14 @@ |
||
52 | 52 | { |
53 | 53 | $packStation = new self(); |
54 | 54 | |
55 | - if (isset($xml->OrderNumber) && (string)$xml->OrderNumber !== '') { |
|
56 | - $packStation->setOrderNumber((string)$xml->OrderNumber); |
|
55 | + if (isset($xml->OrderNumber) && (string) $xml->OrderNumber !== '') { |
|
56 | + $packStation->setOrderNumber((string) $xml->OrderNumber); |
|
57 | 57 | } |
58 | - if (isset($xml->CustomLabel) && (string)$xml->CustomLabel !== '') { |
|
59 | - $packStation->setCustomLabel((string)$xml->CustomLabel); |
|
58 | + if (isset($xml->CustomLabel) && (string) $xml->CustomLabel !== '') { |
|
59 | + $packStation->setCustomLabel((string) $xml->CustomLabel); |
|
60 | 60 | } |
61 | - if (isset($xml->PackstationID) && (string)$xml->PackstationID !== '') { |
|
62 | - $packStation->setPackstationId((string)$xml->PackstationID); |
|
61 | + if (isset($xml->PackstationID) && (string) $xml->PackstationID !== '') { |
|
62 | + $packStation->setPackstationId((string) $xml->PackstationID); |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | return $packStation; |
@@ -407,11 +407,11 @@ |
||
407 | 407 | ); |
408 | 408 | } |
409 | 409 | if (isset($xml->ReceivePromotions) && $xml->ReceivePromotions != '') { |
410 | - $receivePromotions = in_array((string)$xml->ReceivePromotions, ['true','1'], true); |
|
410 | + $receivePromotions = in_array((string) $xml->ReceivePromotions, ['true', '1'], true); |
|
411 | 411 | $customer->setReceivePromotions($receivePromotions); |
412 | 412 | } |
413 | 413 | if (isset($xml->actived) && $xml->actived != '') { |
414 | - $activated = in_array((string)$xml->actived, ['true','1'], true); |
|
414 | + $activated = in_array((string) $xml->actived, ['true', '1'], true); |
|
415 | 415 | $customer->setActivated($activated); |
416 | 416 | } |
417 | 417 | if (isset($xml->Title) && $xml->Title != '') { |
@@ -15,7 +15,7 @@ |
||
15 | 15 | public function getHeaders(): array |
16 | 16 | { |
17 | 17 | return [ |
18 | - 'Accept: application/vnd.bpost.shm-productConfiguration-' . ApiVersions::V3_1 . '+XML', |
|
18 | + 'Accept: application/vnd.bpost.shm-productConfiguration-'.ApiVersions::V3_1.'+XML', |
|
19 | 19 | ]; |
20 | 20 | } |
21 | 21 |
@@ -45,13 +45,13 @@ |
||
45 | 45 | public function getHeaders(): array |
46 | 46 | { |
47 | 47 | return [ |
48 | - 'Content-Type: application/vnd.bpost.shm-orderUpdate-' . ApiVersions::V3 . '+XML', |
|
48 | + 'Content-Type: application/vnd.bpost.shm-orderUpdate-'.ApiVersions::V3.'+XML', |
|
49 | 49 | ]; |
50 | 50 | } |
51 | 51 | |
52 | 52 | public function getUrl(): string |
53 | 53 | { |
54 | - return '/orders/' . $this->reference; |
|
54 | + return '/orders/'.$this->reference; |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | public function isExpectXml(): bool |