Final Class Yiisoft\Middleware\Dispatcher\MiddlewareStack
| Inheritance | Yiisoft\Middleware\Dispatcher\MiddlewareStack |
|---|---|
| Implements | Psr\Http\Server\RequestHandlerInterface |
Public Methods
| Method | Description | Defined By |
|---|---|---|
| __construct() | Yiisoft\Middleware\Dispatcher\MiddlewareStack | |
| handle() | Yiisoft\Middleware\Dispatcher\MiddlewareStack |
Method Details
| public mixed __construct ( Closure[] $middlewares, \Psr\Http\Server\RequestHandlerInterface $fallbackHandler, \Psr\EventDispatcher\EventDispatcherInterface|null $eventDispatcher = null ) | ||
| $middlewares | Closure[] |
Middlewares. |
| $fallbackHandler | \Psr\Http\Server\RequestHandlerInterface |
Fallback handler |
| $eventDispatcher | \Psr\EventDispatcher\EventDispatcherInterface|null |
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 \Psr\Http\Message\ResponseInterface handle ( \Psr\Http\Message\ServerRequestInterface $request ) | ||
| $request | \Psr\Http\Message\ServerRequestInterface | |
public function handle(ServerRequestInterface $request): ResponseInterface
{
if ($this->stack === null) {
$this->build();
}
return $this->stack->handle($request);
}
Signup or Login in order to comment.