| Conditions | 3 |
| Paths | 4 |
| Total Lines | 9 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 3 |
| Changes | 0 | ||
| 1 | <?php |
||
| 26 | 2 | public static function fromThrowable(\Throwable $throwable): self |
|
| 27 | { |
||
| 28 | 2 | $self = new self(); |
|
| 29 | 2 | $self->type = 'https://tools.ietf.org/html/rfc2616#section-10'; |
|
| 30 | 2 | $self->title = 'An error occurred'; |
|
| 31 | 2 | $self->status = $throwable instanceof HttpException ? $throwable->getStatusCode() : Response::HTTP_INTERNAL_SERVER_ERROR; |
|
| 32 | 2 | $self->detail = $throwable instanceof HttpException ? $throwable->getMessage() : 'Internal server error.'; |
|
| 33 | |||
| 34 | 2 | return $self; |
|
| 35 | } |
||
| 37 |