TwigErrorRenderer
in package
implements
ErrorRendererInterface
Provides the ability to render custom Twig-based HTML error pages in non-debug mode, otherwise falls back to HtmlErrorRenderer.
Tags
Interfaces, Classes, Traits and Enums
- ErrorRendererInterface
- Formats an exception to be used as response content.
Table of Contents
- $debug : mixed
- $fallbackErrorRenderer : mixed
- $twig : mixed
- __construct() : mixed
- isDebug() : Closure
- render() : FlattenException
- Renders a Throwable as a FlattenException.
- findTemplate() : string|null
- templateExists() : bool
- To be removed in 5.0.
Properties
$debug
private
mixed
$debug
$fallbackErrorRenderer
private
mixed
$fallbackErrorRenderer
$twig
private
mixed
$twig
Methods
__construct()
public
__construct(Environment $twig[, HtmlErrorRenderer $fallbackErrorRenderer = null ][, bool|callable $debug = false ]) : mixed
Parameters
- $twig : Environment
- $fallbackErrorRenderer : HtmlErrorRenderer = null
- $debug : bool|callable = false
-
The debugging mode as a boolean or a callable that should return it
Return values
mixed —isDebug()
public
static isDebug(RequestStack $requestStack, bool $debug) : Closure
Parameters
- $requestStack : RequestStack
- $debug : bool
Return values
Closure —render()
Renders a Throwable as a FlattenException.
public
render(Throwable $exception) : FlattenException
Parameters
- $exception : Throwable
Return values
FlattenException —findTemplate()
private
findTemplate(int $statusCode) : string|null
Parameters
- $statusCode : int
Return values
string|null —templateExists()
To be removed in 5.0.
private
templateExists(string $template) : bool
Use instead:
$this->twig->getLoader()->exists($template)
Parameters
- $template : string