Conditions | 3 |
Paths | 4 |
Total Lines | 17 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 3.054 |
Changes | 0 |
1 | <?php |
||
39 | 18 | protected static function call($url, $client) |
|
40 | { |
||
41 | 18 | if (!$client) { |
|
42 | $client = new Client(['http_errors' => false]); |
||
43 | } |
||
44 | |||
45 | 18 | $response = $client->get($url); |
|
46 | 18 | $status = $response->getStatusCode(); |
|
47 | |||
48 | 18 | if ($status === 200) { |
|
49 | 9 | $returnData = json_decode($response->getBody()); |
|
50 | 6 | } else { |
|
51 | 9 | throw new ApiException($status); |
|
52 | } |
||
53 | |||
54 | 9 | return $returnData; |
|
55 | } |
||
56 | } |
||
57 |