Lines 0.00% 0 / 5
Functions and Methods 0.00% 0 / 1
Classes and Traits 0.00% 0 / 1
Name Lines Functions and Methods CRAP Classes and Traits
TwigExceptionViewer 0.00% 0 / 5 0.00% 0 / 1 2 0.00% 0 / 1
 __invoke 0.00% 0 / 5 0.00% 0 / 1 2
1<?php
2
3namespace BO\Slim\Controller;
4
5use Psr\Http\Message\RequestInterface;
6use Psr\Http\Message\ResponseInterface;
7
8class TwigExceptionViewer extends \BO\Slim\Controller
9{
10    /**
11     * @SuppressWarnings(Superglobals)
12     */
13    #[\Override]
14    public function __invoke(RequestInterface $request, ResponseInterface $response, array $args)
15    {
16        $request = $this->initRequest($request);
17        $exception = new \Exception($args['message']);
18        /** @psalm-suppress UndefinedPropertyAssignment Exception viewer passes template data to the HTML handler. */
19        $exception->template = $args['template'];
20        /** @psalm-suppress UndefinedPropertyAssignment Exception viewer passes request data to the HTML handler. */
21        $exception->data = $_REQUEST;
22        return \BO\Slim\TwigExceptionHandler::withHtml($request, $response, $exception);
23    }
24}