@@ -60,21 +60,21 @@ |
||
| 60 | 60 | { |
| 61 | 61 | $response = $this->httpClient->request( |
| 62 | 62 | 'GET', |
| 63 | - self::SERVICE_URI. '/' . $code |
|
| 63 | + self::SERVICE_URI . '/' . $code |
|
| 64 | 64 | ); |
| 65 | 65 | |
| 66 | 66 | $body = json_decode((string) $response->getBody(), true); |
| 67 | 67 | |
| 68 | 68 | return new Address( |
| 69 | - $body['destinataire'], |
|
| 70 | - $body['pointRemise'], |
|
| 71 | - $body['numeroVoie'], |
|
| 72 | - $body['libelleVoie'], |
|
| 73 | - $body['lieuDit'], |
|
| 74 | - $body['codePostal'], |
|
| 75 | - $body['codeCedex'], |
|
| 76 | - $body['commune'], |
|
| 77 | - $body['blocAdresse'] |
|
| 69 | + $body[ 'destinataire' ], |
|
| 70 | + $body[ 'pointRemise' ], |
|
| 71 | + $body[ 'numeroVoie' ], |
|
| 72 | + $body[ 'libelleVoie' ], |
|
| 73 | + $body[ 'lieuDit' ], |
|
| 74 | + $body[ 'codePostal' ], |
|
| 75 | + $body[ 'codeCedex' ], |
|
| 76 | + $body[ 'commune' ], |
|
| 77 | + $body[ 'blocAdresse' ] |
|
| 78 | 78 | ); |
| 79 | 79 | } |
| 80 | 80 | } |
@@ -51,17 +51,17 @@ discard block |
||
| 51 | 51 | $body = json_decode((string) $response->getBody(), true); |
| 52 | 52 | |
| 53 | 53 | return new Status( |
| 54 | - $body['code'], |
|
| 55 | - $body['date'], |
|
| 56 | - $body['status'], |
|
| 57 | - $body['message'], |
|
| 58 | - $body['link'], |
|
| 59 | - $body['type'] |
|
| 54 | + $body[ 'code' ], |
|
| 55 | + $body[ 'date' ], |
|
| 56 | + $body[ 'status' ], |
|
| 57 | + $body[ 'message' ], |
|
| 58 | + $body[ 'link' ], |
|
| 59 | + $body[ 'type' ] |
|
| 60 | 60 | ); |
| 61 | 61 | } catch (RequestException $e) { |
| 62 | 62 | $body = json_decode($e->getResponse()->getBody(), true); |
| 63 | - if (isset($body['message'])) { |
|
| 64 | - throw Exception::trackingError($body['message']); |
|
| 63 | + if (isset($body[ 'message' ])) { |
|
| 64 | + throw Exception::trackingError($body[ 'message' ]); |
|
| 65 | 65 | } else { |
| 66 | 66 | throw Exception::trackingError('No error message were provided'); |
| 67 | 67 | } |
@@ -90,28 +90,28 @@ discard block |
||
| 90 | 90 | |
| 91 | 91 | $body = json_decode((string) $response->getBody(), true); |
| 92 | 92 | |
| 93 | - $results = []; |
|
| 93 | + $results = [ ]; |
|
| 94 | 94 | foreach ($body as $item) { |
| 95 | - if (isset($item['data'])) { |
|
| 96 | - $status = $item['data']; |
|
| 95 | + if (isset($item[ 'data' ])) { |
|
| 96 | + $status = $item[ 'data' ]; |
|
| 97 | 97 | array_push( |
| 98 | 98 | $results, |
| 99 | 99 | new Status( |
| 100 | - $status['code'], |
|
| 101 | - $status['message'], |
|
| 102 | - $status['date'], |
|
| 103 | - $status['status'], |
|
| 104 | - $status['link'], |
|
| 105 | - $status['type'] |
|
| 100 | + $status[ 'code' ], |
|
| 101 | + $status[ 'message' ], |
|
| 102 | + $status[ 'date' ], |
|
| 103 | + $status[ 'status' ], |
|
| 104 | + $status[ 'link' ], |
|
| 105 | + $status[ 'type' ] |
|
| 106 | 106 | ) |
| 107 | 107 | ); |
| 108 | - } else if (isset($item['error'])) { |
|
| 109 | - $error = $item['error']; |
|
| 108 | + } else if (isset($item[ 'error' ])) { |
|
| 109 | + $error = $item[ 'error' ]; |
|
| 110 | 110 | array_push( |
| 111 | 111 | $results, |
| 112 | 112 | new Status( |
| 113 | - $error['code'], |
|
| 114 | - $error['message'] |
|
| 113 | + $error[ 'code' ], |
|
| 114 | + $error[ 'message' ] |
|
| 115 | 115 | ) |
| 116 | 116 | ); |
| 117 | 117 | } |