Lines
0.00%
0 / 10
Functions and Methods
0.00%
0 / 1
Classes and Traits
0.00%
0 / 1
| Name | Lines | Functions and Methods | CRAP | Classes and Traits | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| TwigExceptionHandler | 0.00% | 0 / 10 | 0.00% | 0 / 1 | 20 | 0.00% | 0 / 1 | |||
| withHtml | 0.00% | 0 / 10 | 0.00% | 0 / 1 | 20 | |||||
| 1 | <?php | |
| 2 | ||
| 3 | namespace BO\Zmsadmin\Helper; | |
| 4 | ||
| 5 | use Psr\Http\Message\RequestInterface; | |
| 6 | use Psr\Http\Message\ResponseInterface; | |
| 7 | ||
| 8 | class TwigExceptionHandler extends \BO\Slim\TwigExceptionHandler | |
| 9 | { | |
| 10 | #[\Override] | |
| 11 | public static function withHtml( | |
| 12 | RequestInterface $request, | |
| 13 | ResponseInterface $response, | |
| 14 | \Throwable $exception, | |
| 15 | $status = 500 | |
| 16 | ): ResponseInterface { | |
| 17 | if ($exception instanceof \Slim\Exception\HttpNotFoundException) { | |
| 18 | \BO\Slim\Controller::prepareRequest($request); | |
| 19 | return \BO\Slim\Render::withHtml($response, 'page/404.twig'); | |
| 20 | } | |
| 21 | try { | |
| 22 | $workstation = \App::$http->readGetResult('/workstation/')->getEntity(); | |
| 23 | $data = []; | |
| 24 | if (isset($exception->data)) { | |
| 25 | $data = $exception->data; | |
| 26 | } | |
| 27 | $exception->templatedata = array('workstation' => $workstation, 'sourceData' => $data); | |
| 28 | } catch (\Throwable $workstationexception) { | |
| 29 | // ignore | |
| 30 | } | |
| 31 | return parent::withHtml($request, $response, $exception, $status); | |
| 32 | } | |
| 33 | } |