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