Conditions | 2 |
Paths | 2 |
Total Lines | 13 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 2 |
Changes | 0 |
1 | <?php |
||
16 | 1 | public static function errorResponse(ResponseInterface $response, $data) |
|
17 | { |
||
18 | 1 | $message = $data['error']['type']; |
|
19 | |||
20 | 1 | if (!empty($data['error']['message'])) { |
|
21 | 1 | $message .= ': '.$data['error']['message']; |
|
22 | } |
||
23 | |||
24 | 1 | $code = $response->getStatusCode(); |
|
25 | 1 | $body = (string) $response->getBody(); |
|
26 | |||
27 | 1 | return new static($message, $code, $body); |
|
28 | } |
||
29 | } |
||
30 |