Final Class Yiisoft\Middleware\Dispatcher\MiddlewareStack
| Inheritance | Yiisoft\ |
|---|---|
| Implements | Psr\ |
Public Methods
| Method | Description | Defined By |
|---|---|---|
| __construct() | Yiisoft\ |
|
| handle() | Yiisoft\ |
Method Details
| public mixed __construct ( Closure[] $middlewares, \ | ||
| $middlewares | Closure[] |
Middlewares. |
| $fallbackHandler | \ |
Fallback handler |
| $eventDispatcher | \ |
Event dispatcher to use for triggering before/after middleware events. |
public function __construct(
private readonly array $middlewares,
private readonly RequestHandlerInterface $fallbackHandler,
private readonly ?EventDispatcherInterface $eventDispatcher = null,
) {
if ($middlewares === []) {
throw new RuntimeException('Stack is empty.');
}
}
| public \ | ||
| $request | \ |
|
public function handle(ServerRequestInterface $request): ResponseInterface
{
if ($this->stack === null) {
$this->build();
}
return $this->stack->handle($request);
}
User Contributed Notes
Leave a comment
Join the conversation to share a note.