protected function buildView(\Throwable $exception, array $renderingOptions): ViewInterface
    {
        $statusCode = ($exception instanceof WithHttpStatusInterface) ? $exception->getStatusCode() : 500;
        $referenceCode = ($exception instanceof WithReferenceCodeInterface) ? $exception->getReferenceCode() : null;

        $statusMessage = ResponseInformationHelper::getStatusMessageByCode($statusCode);
        $viewClassName = $renderingOptions['viewClassName'];
        /** @var ViewInterface $view */
        $view = $viewClassName::createWithOptions($renderingOptions['viewOptions']);
        $view = $this->applyLegacyViewOptions($view, $renderingOptions);

        $httpRequest = Request::createFromEnvironment();
        $request = new ActionRequest($httpRequest);
        $request->setControllerPackageKey('Neos.Flow');
        $uriBuilder = new UriBuilder();
        $uriBuilder->setRequest($request);
        $view->setControllerContext(new ControllerContext(
            $request,
            new ActionResponse(),
            new Arguments([]),
            $uriBuilder
        ));

        if (isset($renderingOptions['variables'])) {
            $view->assignMultiple($renderingOptions['variables']);
        }

        $view->assignMultiple([
            'exception' => $exception,
            'renderingOptions' => $renderingOptions,
            'statusCode' => $statusCode,
            'statusMessage' => $statusMessage,
            'referenceCode' => $referenceCode
        ]);

        return $view;
    }
protected function buildView(\Throwable $exception, array $renderingOptions): ViewInterface
    {
        $statusCode = ($exception instanceof WithHttpStatusInterface) ? $exception->getStatusCode() : 500;
        $referenceCode = ($exception instanceof WithReferenceCodeInterface) ? $exception->getReferenceCode() : null;

        $statusMessage = ResponseInformationHelper::getStatusMessageByCode($statusCode);
        $viewClassName = $renderingOptions['viewClassName'];
        /** @var ViewInterface $view */
        $view = $viewClassName::createWithOptions($renderingOptions['viewOptions']);
        $view = $this->applyLegacyViewOptions($view, $renderingOptions);

        $httpRequest = Request::createFromEnvironment();
        $request = new ActionRequest($httpRequest);
        $request->setControllerPackageKey('Neos.Flow');
        $uriBuilder = new UriBuilder();
        $uriBuilder->setRequest($request);
        $view->setControllerContext(new ControllerContext(
            $request,
            new ActionResponse(),
            new Arguments([]),
            $uriBuilder
        ));

        if (isset($renderingOptions['variables'])) {
            $view->assignMultiple($renderingOptions['variables']);
        }

        $view->assignMultiple([
            'exception' => $exception,
            'renderingOptions' => $renderingOptions,
            'statusCode' => $statusCode,
            'statusMessage' => $statusMessage,
            'referenceCode' => $referenceCode
        ]);

        return $view;
    }
protected function buildView ( \ Throwable $ exception , array $ renderingOptions ) : ViewInterface { $ statusCode = ( $ exception instanceof WithHttpStatusInterface ) ? $ exception -> getStatusCode ( ) : 500 ; $ referenceCode = ( $ exception instanceof WithReferenceCodeInterface ) ? $ exception -> getReferenceCode ( ) : null ; $ statusMessage = ResponseInformationHelper :: getStatusMessageByCode ( $ statusCode ) ; $ viewClassName = $ renderingOptions [ 'viewClassName' ] ; /** @var ViewInterface $view */ $ view = $ viewClassName :: createWithOptions ( $ renderingOptions [ 'viewOptions' ] ) ; $ view = $ this -> applyLegacyViewOptions ( $ view , $ renderingOptions ) ; $ httpRequest = Request :: createFromEnvironment ( ) ; $ request = new ActionRequest ( $ httpRequest ) ; $ request -> setControllerPackageKey ( 'Neos.Flow' ) ; $ uriBuilder = new UriBuilder ( ) ; $ uriBuilder -> setRequest ( $ request ) ; $ view -> setControllerContext ( new ControllerContext ( $ request , new ActionResponse ( ) , new Arguments ( [ ] ) , $ uriBuilder ) ) ; if ( isset ( $ renderingOptions [ 'variables' ] ) ) { $ view -> assignMultiple ( $ renderingOptions [ 'variables' ] ) ; } $ view -> assignMultiple ( [ 'exception' => $ exception , 'renderingOptions' => $ renderingOptions , 'statusCode' => $ statusCode , 'statusMessage' => $ statusMessage , 'referenceCode' => $ referenceCode ] ) ; return $ view ; }
Prepares a Fluid view for rendering the custom error page.

@param \Throwable $exception
@param array $renderingOptions Rendering options as defined in the settings
@return ViewInterface
Prepares a Fluid view for rendering the custom error page .