| Conditions | 3 |
| Paths | 3 |
| Total Lines | 20 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 1 | Features | 0 |
| 1 | <?php |
||
| 17 | public function __construct(Throwable $e) |
||
| 18 | { |
||
| 19 | /** @var array<int, string> $text */ |
||
| 20 | $text = (new StatusCode())->statusText; |
||
| 21 | if ($e instanceof BadRequestException) { |
||
| 22 | $this->code = $e->getCode(); |
||
| 23 | $this->text = $text[$this->code] ?? ''; |
||
| 24 | |||
| 25 | return; |
||
| 26 | } |
||
| 27 | |||
| 28 | if ($e instanceof RuntimeException) { |
||
| 29 | $this->code = 503; |
||
| 30 | $this->text = $text[$this->code]; |
||
| 31 | |||
| 32 | return; |
||
| 33 | } |
||
| 34 | |||
| 35 | $this->code = 500; |
||
| 36 | $this->text = $text[$this->code]; |
||
| 37 | } |
||
| 39 |