| Conditions | 3 |
| Paths | 3 |
| Total Lines | 15 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 3.0175 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 11 | 4 | public function resolve(HandlerParameterAttributeInterface $attribute, ServerRequestInterface $request): mixed |
|
| 12 | { |
||
| 13 | 4 | if ($attribute::class !== Request::class) { |
|
| 14 | 1 | throw new \InvalidArgumentException(sprintf('Expected "%s", got "%s".', Request::class, $attribute::class)); |
|
| 15 | } |
||
| 16 | |||
| 17 | 3 | $notFoundValue = NotFoundValue::getInstance(); |
|
| 18 | |||
| 19 | /** @var mixed $result */ |
||
| 20 | 3 | $result = $request->getAttribute($attribute->getName(), $notFoundValue); |
|
|
|
|||
| 21 | 3 | if ($result === $notFoundValue) { |
|
| 22 | throw new ValueNotFoundException(); |
||
| 23 | } |
||
| 24 | |||
| 25 | 3 | return $result; |
|
| 26 | } |
||
| 28 |