Total Complexity | 3 |
Total Lines | 45 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
13 | class ContinentsClient extends NStackClient |
||
14 | { |
||
15 | /** @var string */ |
||
16 | protected $path = 'geographic/continents'; |
||
17 | |||
18 | /** |
||
19 | * index |
||
20 | * |
||
21 | * @return array |
||
22 | * @throws \NStack\Exceptions\FailedToParseException |
||
23 | * @author Casper Rasmussen <[email protected]> |
||
24 | */ |
||
25 | 1 | public function index(): array |
|
26 | { |
||
27 | 1 | $response = $this->client->get($this->buildPath($this->path)); |
|
28 | |||
29 | 1 | $contents = $response->getBody()->getContents(); |
|
30 | |||
31 | 1 | $data = json_decode($contents, true); |
|
32 | |||
33 | 1 | $array = []; |
|
34 | 1 | foreach ($data['data'] as $object) { |
|
35 | 1 | $array[] = new Continent($object); |
|
36 | } |
||
37 | |||
38 | 1 | return $array; |
|
39 | } |
||
40 | |||
41 | /** |
||
42 | * show |
||
43 | * |
||
44 | * @param $id |
||
45 | * @return \NStack\Models\Continent |
||
46 | * @throws \NStack\Exceptions\FailedToParseException |
||
47 | * @author Casper Rasmussen <[email protected]> |
||
48 | */ |
||
49 | 1 | public function show($id): Continent |
|
58 | } |
||
59 | } |