Conditions | 3 |
Paths | 2 |
Total Lines | 15 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
20 | public function execute(string $postalCode) |
||
21 | { |
||
22 | $response = $this->httpClient->get($this->api.$postalCode); |
||
23 | $content = json_decode($response->getBody()->getContents(), true); |
||
24 | |||
25 | $features = $content['features']; |
||
26 | if(isset($features) && !empty($features)){ |
||
27 | $feature = $features[0]; |
||
28 | $coordinates = $feature['geometry']['coordinates']; |
||
29 | $departmentNumber = explode(',', $feature['properties']['context'])[0]; |
||
30 | } |
||
31 | |||
32 | return [ |
||
33 | 'coordinates' => $coordinates, |
||
|
|||
34 | 'department_number' => $departmentNumber |
||
35 | ]; |
||
38 |