| Total Complexity | 6 |
| Total Lines | 37 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 2 | ||
| Bugs | 1 | Features | 0 |
| 1 | <?php |
||
| 17 | 2 | final class ProdVndErrorPage extends ResourceObject |
|
| 18 | 2 | { |
|
| 19 | public function __construct(Throwable $e, RouterMatch $request) |
||
| 26 | } |
||
| 27 | 2 | ||
| 28 | public function toString(): string |
||
| 29 | 2 | { |
|
| 30 | $this->view = json_encode($this->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES) . PHP_EOL; |
||
| 31 | |||
| 32 | 2 | return $this->view; |
|
| 33 | } |
||
| 34 | 2 | ||
| 35 | 2 | /** |
|
| 36 | 2 | * @return array<string, string> |
|
| 37 | 2 | */ |
|
| 38 | private function getHeader(int $code): array |
||
| 39 | { |
||
| 40 | 2 | return ['content-type' => $code >= 500 ? 'application/vnd.error+json' : 'application/json']; |
|
| 41 | } |
||
| 42 | |||
| 43 | /** |
||
| 44 | * @return array<string, string> |
||
| 45 | */ |
||
| 46 | private function getResponseBody(Throwable $e, Status $status): array |
||
| 54 | } |
||
| 55 | } |
||
| 56 |