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