Lines
50.00%
6 / 12
Methods
50.00%
2 / 4
Classes
0.00%
0 / 1
| Name | Lines | Methods | CRAP | ||||
|---|---|---|---|---|---|---|---|
| __invoke | 0.00% | 0 / 5 | 0.00% | 0 / 1 | 2 | ||
| [BO\Slim\Controller] __construct | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | ||
| [BO\Slim\Controller] prepareRequest | 80.00% | 4 / 5 | 0.00% | 0 / 1 | 3.07 | ||
| [BO\Slim\Controller] initRequest | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | ||
| 8 | class 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 | } |
Inherited from BO\Slim\Controller
| 33 | public function __construct(ContainerInterface $containerInterface) | |
| 34 | { | |
| 35 | $this->containerInterface = $containerInterface; | |
| 36 | } |
| 68 | public static function prepareRequest(RequestInterface $request): RequestInterface | |
| 69 | { | |
| 70 | /** @psalm-suppress RedundantCondition Module App subclasses may set MULTILANGUAGE to false. */ | |
| 71 | \App::$language = (\App::MULTILANGUAGE) ? | |
| 72 | new \BO\Slim\Language($request, \App::$supportedLanguages) : | |
| 73 | new \BO\Slim\Language($request, array_slice(\App::$supportedLanguages, 0)); | |
| 74 | \App::$now = (\App::$now instanceof \DateTimeInterface) ? \App::$now : new \DateTimeImmutable(); | |
| 75 | return $request; | |
| 76 | } |
| 78 | public function initRequest(RequestInterface $request): RequestInterface | |
| 79 | { | |
| 80 | return self::prepareRequest($request); | |
| 81 | } |