Final Class Yiisoft\HttpMiddleware\TagRequest\TagRequestMiddleware
| Inheritance | Yiisoft\ |
|---|---|
| Implements | Psr\ |
Tags request with a value that could be later used for identifying it.
Public Methods
| Method | Description | Defined By |
|---|---|---|
| __construct() | Yiisoft\ |
|
| process() | Yiisoft\ |
Method Details
| public mixed __construct ( string $attributeName = 'requestTag', Yiisoft\ | ||
| $attributeName | string |
The name of the attribute to store the tag in. |
| $tagProvider | Yiisoft\ |
The tag provider. |
public function __construct(
private readonly string $attributeName = 'requestTag',
private readonly TagProviderInterface $tagProvider = new TimeBasedTagProvider(),
) {}
| public \ | ||
| $request | \ |
|
| $handler | \ |
|
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
{
$request = $request->withAttribute(
$this->attributeName,
$this->tagProvider->get(),
);
return $handler->handle($request);
}
User Contributed Notes
Leave a comment
Join the conversation to share a note.