Final Class Yiisoft\RequestModel\Attribute\RouteResolver
| Inheritance | Yiisoft\ |
|---|---|
| Implements | Yiisoft\ |
Public Methods
| Method | Description | Defined By |
|---|---|---|
| __construct() | Yiisoft\ |
|
| resolve() | Yiisoft\ |
Method Details
| public mixed __construct ( \ | ||
| $currentRoute | \ |
|
public function __construct(private CurrentRoute $currentRoute)
{
}
| public mixed resolve ( Yiisoft\ | ||
| $attribute | Yiisoft\ |
|
| $request | \ |
|
public function resolve(HandlerParameterAttributeInterface $attribute, ServerRequestInterface $request): mixed
{
if ($attribute::class !== Route::class) {
throw new \InvalidArgumentException(sprintf('Expected "%s", got "%s".', Route::class, $attribute::class));
}
return $this->currentRoute->getArgument($attribute->getName()) ?? throw new ValueNotFoundException();
}
User Contributed Notes
Leave a comment
Join the conversation to share a note.