src/Router/Middleware/ErrorPage.php
protected function getErrorRoute(ServerRequestInterface $request, ResponseInterface $response)
    {
        if (
            interface_exists('Jasny\HttpMessage\GlobalEnvironmentInterface') &&
            $request instanceof GlobalEnvironmentInterface
        ) {
            $request = $request->withoutGlobalEnvironment();
        }
        
        $status = $response->getStatusCode();
        
        $errorUri = $request->getUri()
            ->withPath($status)
            ->withQuery(null)
            ->withFragment(null);
        
        return $this->router->getRoutes()->getRoute($request->withUri($errorUri));
    }
protected function getErrorRoute(ServerRequestInterface $request, ResponseInterface $response)
    {
        if (
            interface_exists('Jasny\HttpMessage\GlobalEnvironmentInterface') &&
            $request instanceof GlobalEnvironmentInterface
        ) {
            $request = $request->withoutGlobalEnvironment();
        }
        
        $status = $response->getStatusCode();
        
        $errorUri = $request->getUri()
            ->withPath($status)
            ->withQuery(null)
            ->withFragment(null);
        
        return $this->router->getRoutes()->getRoute($request->withUri($errorUri));
    }
protected function getErrorRoute ( ServerRequestInterface $ request , ResponseInterface $ response ) { if ( interface_exists ( 'Jasny\HttpMessage\GlobalEnvironmentInterface' ) && $ request instanceof GlobalEnvironmentInterface ) { $ request = $ request -> withoutGlobalEnvironment ( ) ; } $ status = $ response -> getStatusCode ( ) ; $ errorUri = $ request -> getUri ( ) -> withPath ( $ status ) -> withQuery ( null ) -> withFragment ( null ) ; return $ this -> router -> getRoutes ( ) -> getRoute ( $ request -> withUri ( $ errorUri ) ) ; }
Get the route to the error page

@param ServerRequestInterface $request
@param ResponseInterface $response
@return Router\Route
Get the route to the error page