| Conditions | 3 |
| Paths | 3 |
| Total Lines | 15 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 3 |
| Changes | 0 | ||
| 1 | <?php |
||
| 21 | 3 | public function getParameterValue(ParameterAttributeInterface $attribute, Context $context): Result |
|
| 22 | { |
||
| 23 | 3 | if (!$attribute instanceof RouteArgument) { |
|
| 24 | 1 | throw new UnexpectedAttributeException(RouteArgument::class, $attribute); |
|
| 25 | } |
||
| 26 | |||
| 27 | 2 | $arguments = $this->currentRoute->getArguments(); |
|
| 28 | |||
| 29 | 2 | $name = $attribute->getName() ?? $context->getParameter()->getName(); |
|
| 30 | |||
| 31 | 2 | if (array_key_exists($name, $arguments)) { |
|
| 32 | 1 | return Result::success($arguments[$name]); |
|
| 33 | } |
||
| 34 | |||
| 35 | 1 | return Result::fail(); |
|
| 36 | } |
||
| 38 |