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