| Conditions | 1 |
| Paths | 1 |
| Total Lines | 23 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 11 | public function getAddressFromZipcode($zipCode) |
||
| 12 | { |
||
| 13 | $zipCode = preg_replace('/[^0-9]/im', '', $zipCode); |
||
| 14 | |||
| 15 | $headers = [ |
||
| 16 | "Accept" => "application/json", |
||
| 17 | ]; |
||
| 18 | |||
| 19 | $client = new Client(['base_uri' => "{$this->endPoint}/{$zipCode}"]); |
||
| 20 | |||
| 21 | $response = $client->get( |
||
| 22 | '', |
||
| 23 | [ |
||
| 24 | 'headers' => $headers, |
||
| 25 | 'connect_timeout' => 5, // seconds |
||
| 26 | 'debug' => false, |
||
| 27 | ] |
||
| 28 | ); |
||
| 29 | |||
| 30 | $response = $response->getBody()->getContents(); |
||
| 31 | $response = json_decode($response); |
||
| 32 | |||
| 33 | return $this->normalizeResponse((array)$response); |
||
| 34 | } |
||
| 59 |