Conditions | 3 |
Paths | 2 |
Total Lines | 12 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 12 |
Changes | 0 |
1 | <?php |
||
10 | public static function serviceRespondedWithAnError(ResponseInterface $response) |
||
11 | { |
||
12 | $statusCode = $response->getStatusCode(); |
||
13 | |||
14 | $result = json_decode($response->getBody()); |
||
15 | |||
16 | if ($result && isset($result->errors)) { |
||
17 | return new static('Pushover responded with an error ('.$statusCode.'): '.implode(', ', $result->errors)); |
||
18 | } |
||
19 | |||
20 | return new static('Pushover responded with an error ('.$statusCode.').'); |
||
21 | } |
||
22 | } |
||
23 |