Conditions | 2 |
Paths | 2 |
Total Lines | 12 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 2 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
30 | 112 | public static function fromErrorResponse(Response $response) : self |
|
31 | { |
||
32 | 112 | $self = new self( |
|
33 | 112 | $response->getBodyField(Keys::ERROR_24), |
|
34 | 112 | $response->getCode() & (Response::TYPE_ERROR - 1) |
|
35 | 112 | ); |
|
36 | |||
37 | 112 | if ($error = $response->tryGetBodyField(Keys::ERROR)) { |
|
38 | 112 | $self->error = Error::fromMap($error); |
|
39 | } |
||
40 | |||
41 | 112 | return $self; |
|
42 | } |
||
54 |