Conditions | 3 |
Paths | 3 |
Total Lines | 13 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
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 | $queryParams = $request->getQueryParams(); |
|
18 | |||
19 | 2 | if ($attribute->getName() !== null) { |
|
|
|||
20 | 1 | return $queryParams[$attribute->getName()] ?? throw new ValueNotFoundException(); |
|
21 | } |
||
22 | |||
23 | 1 | return $queryParams; |
|
24 | } |
||
26 |