Final Class Yiisoft\ErrorHandler\RendererProvider\ClosureRendererProvider
| Inheritance | Yiisoft\ |
|---|---|
| Implements | Yiisoft\ |
Provides a renderer based on a closure that returns a ThrowableRendererInterface or its class name.
Public Methods
| Method | Description | Defined By |
|---|---|---|
| __construct() | Yiisoft\ |
|
| get() | Yiisoft\ |
Method Details
| public mixed __construct ( Closure $closure, \ | ||
| $closure | Closure | |
| $container | \ |
|
public function __construct(
private readonly Closure $closure,
private readonly ContainerInterface $container,
) {}
| public ?\ | ||
| $request | \ |
|
public function get(ServerRequestInterface $request): ?ThrowableRendererInterface
{
$result = ($this->closure)($request);
if (is_string($result)) {
/** @var ThrowableRendererInterface */
return $this->container->get($result);
}
return $result;
}
User Contributed Notes
Leave a comment
Join the conversation to share a note.