protected function getRenderer($exception, $request)
    {
        if (!$this->exceptionRenderer) {
            $this->exceptionRenderer = $this->getConfig('exceptionRenderer') ?: ExceptionRenderer::class;
        }

        // For PHP5 backwards compatibility
        if ($exception instanceof Error) {
            $exception = new PHP7ErrorException($exception);
        }

        if (is_string($this->exceptionRenderer)) {
            $class = App::className($this->exceptionRenderer, 'Error');
            if (!$class) {
                throw new Exception(sprintf(
                    "The '%s' renderer class could not be found.",
                    $this->exceptionRenderer
                ));
            }

            return new $class($exception, $request);
        }
        $factory = $this->exceptionRenderer;

        return $factory($exception, $request);
    }
protected function getRenderer($exception, $request)
    {
        if (!$this->exceptionRenderer) {
            $this->exceptionRenderer = $this->getConfig('exceptionRenderer') ?: ExceptionRenderer::class;
        }

        // For PHP5 backwards compatibility
        if ($exception instanceof Error) {
            $exception = new PHP7ErrorException($exception);
        }

        if (is_string($this->exceptionRenderer)) {
            $class = App::className($this->exceptionRenderer, 'Error');
            if (!$class) {
                throw new Exception(sprintf(
                    "The '%s' renderer class could not be found.",
                    $this->exceptionRenderer
                ));
            }

            return new $class($exception, $request);
        }
        $factory = $this->exceptionRenderer;

        return $factory($exception, $request);
    }
protected function getRenderer ( $ exception , $ request ) { if ( ! $ this -> exceptionRenderer ) { $ this -> exceptionRenderer = $ this -> getConfig ( 'exceptionRenderer' ) ? : ExceptionRenderer :: class ; } // For PHP5 backwards compatibility if ( $ exception instanceof Error ) { $ exception = new PHP7ErrorException ( $ exception ) ; } if ( is_string ( $ this -> exceptionRenderer ) ) { $ class = App :: className ( $ this -> exceptionRenderer , 'Error' ) ; if ( ! $ class ) { throw new Exception ( sprintf ( "The '%s' renderer class could not be found." , $ this -> exceptionRenderer ) ) ; } return new $ class ( $ exception , $ request ) ; } $ factory = $ this -> exceptionRenderer ; return $ factory ( $ exception , $ request ) ; }
Get a renderer instance

@param \Exception $exception The exception being rendered.
@param \Psr\Http\Message\ServerRequestInterface $request The request.
@return \Cake\Error\ExceptionRendererInterface The exception renderer.
@throws \Exception When the renderer class cannot be found.
Get a renderer instance