Conditions | 3 |
Paths | 3 |
Total Lines | 11 |
Code Lines | 5 |
Lines | 0 |
Ratio | 0 % |
Tests | 6 |
CRAP Score | 3 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
11 | 3 | public function resolve(HandlerParameterAttributeInterface $attribute, ServerRequestInterface $request): mixed |
|
12 | { |
||
13 | 3 | if ($attribute::class !== Query::class) { |
|
14 | 1 | throw new \InvalidArgumentException(sprintf('Expected "%s", got "%s".', Query::class, $attribute::class)); |
|
15 | } |
||
16 | |||
17 | 2 | if ($attribute->getName() !== null) { |
|
|
|||
18 | 1 | return $request->getQueryParams()[$attribute->getName()] ?? null; |
|
19 | } |
||
20 | |||
21 | 1 | return $request->getQueryParams(); |
|
22 | } |
||
24 |