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