Zend\Expressive\TemplatedErrorHandler::__construct PHP Method

__construct() public method

public __construct ( Zend\Expressive\Template\TemplateRendererInterface $renderer = null, null | string $template404 = 'error::404', null | string $templateError = 'error::error', Psr\Http\Message\ResponseInterface $originalResponse = null )
$renderer Zend\Expressive\Template\TemplateRendererInterface Template renderer.
$template404 null | string Template to use for 404 responses.
$templateError null | string Template to use for general errors.
$originalResponse Psr\Http\Message\ResponseInterface Original response (used to calculate if the response has changed during middleware execution).
    public function __construct(Template\TemplateRendererInterface $renderer = null, $template404 = 'error::404', $templateError = 'error::error', Response $originalResponse = null)
    {
        $this->renderer = $renderer;
        $this->template404 = $template404;
        $this->templateError = $templateError;
        if ($originalResponse) {
            $this->setOriginalResponse($originalResponse);
        }
    }

Usage Example

 /**
  * @param Whoops $whoops
  * @param PrettyPageHandler $whoopsHandler
  * @param null|Template\TemplateRendererInterface $renderer
  * @param null|string $template404
  * @param null|string $templateError
  * @param null|Response $originalResponse
  */
 public function __construct(Whoops $whoops, PrettyPageHandler $whoopsHandler, Template\TemplateRendererInterface $renderer = null, $template404 = 'error/404', $templateError = 'error/error', Response $originalResponse = null)
 {
     $this->whoops = $whoops;
     $this->whoopsHandler = $whoopsHandler;
     parent::__construct($renderer, $template404, $templateError, $originalResponse);
 }