Conditions | 2 |
Paths | 2 |
Total Lines | 15 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 6 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
36 | public static function fromBadResponse(BadResponseException $previous) |
||
37 | { |
||
38 | $statusCode = $previous->getResponse()->getStatusCode(); |
||
39 | $message = sprintf( |
||
40 | static::$messageTemplate, |
||
41 | $previous->getMessage(), |
||
42 | $previous->getRequest(), |
||
43 | $previous->getResponse() |
||
44 | ); |
||
45 | if (array_key_exists($statusCode, static::$exceptions)) { |
||
46 | return new static::$exceptions[$statusCode]($message, 0, $previous); |
||
47 | } |
||
48 | |||
49 | return new self($message, 0, $previous); |
||
50 | } |
||
51 | } |
||
52 |