Final Class Yiisoft\Yii\Debug\Api\Debug\Http\HttpApplicationWrapper
| Inheritance | Yiisoft\ |
|---|
Public Methods
| Method | Description | Defined By |
|---|---|---|
| __construct() | Yiisoft\ |
|
| wrap() | Yiisoft\ |
Method Details
| public mixed __construct ( \ | ||
| $middlewareDispatcher | \ |
|
| $middlewareDefinitions | array | |
public function __construct(
private MiddlewareDispatcher $middlewareDispatcher,
private array $middlewareDefinitions,
) {}
| public \ | ||
| $application | \ |
|
public function wrap(Application $application): Application
{
$middlewareDispatcher = $this->middlewareDispatcher;
$middlewareDefinitions = $this->middlewareDefinitions;
/**
* `Application` properties are readonly, so create a new instance with a wrapped dispatcher.
*
* @psalm-suppress InaccessibleProperty
*/
$closure = Closure::bind(
static fn(Application $application): Application => new Application(
$middlewareDispatcher->withMiddlewares([
...$middlewareDefinitions,
['class' => MiddlewareDispatcherMiddleware::class, '$middlewareDispatcher' => $application->dispatcher],
]),
$application->eventDispatcher,
$application->fallbackHandler,
),
null,
Application::class,
);
return $closure($application);
}
User Contributed Notes
Leave a comment
Join the conversation to share a note.