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