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