Conditions | 3 |
Paths | 3 |
Total Lines | 11 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Tests | 6 |
CRAP Score | 3 |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
24 | 16 | protected function get(string $path) |
|
25 | { |
||
26 | 15 | $response = $this->client->request('GET', $path); |
|
27 | 1 | ||
28 | 14 | if ($response->getStatusCode() !== 200) { |
|
29 | 1 | throw new \Exception('Client error: `GET '. $path .'` resulted in a '. $response->getStatusCode() .' response'); |
|
30 | } elseif ($response->getBody()->getSize() === 0) { |
||
31 | throw new \Exception('Client error: `GET '. $path .'` resulted in a empty response body'); |
||
32 | 13 | } |
|
33 | |||
34 | return json_decode($response->getBody(), true); |
||
35 | } |
||
38 |