| Conditions | 4 |
| Paths | 3 |
| Total Lines | 22 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 12 |
| CRAP Score | 4 |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 24 | 12 | public function resolve(Request $request, ArgumentMetadata $argument) |
|
| 25 | { |
||
| 26 | /** @var ConstraintViolationListInterface|null $errorsQueue */ |
||
| 27 | 12 | $violationList = $request->attributes->get(self::REQUEST_ATTR_KEY); |
|
| 28 | |||
| 29 | 12 | if ($violationList === null) { |
|
| 30 | 1 | throw new \InvalidArgumentException( |
|
| 31 | 1 | sprintf( |
|
| 32 | 1 | 'The action argument "%s \$%s" is required.', |
|
| 33 | 1 | (string) $argument->getType(), |
|
| 34 | 1 | $argument->getName() |
|
| 35 | ) |
||
| 36 | ); |
||
| 37 | } |
||
| 38 | |||
| 39 | 11 | $request->attributes->remove(self::REQUEST_ATTR_KEY); |
|
| 40 | |||
| 41 | 11 | if ($argument->isNullable() && $violationList->count() === 0) { |
|
| 42 | 1 | $violationList = null; |
|
| 43 | } |
||
| 44 | |||
| 45 | 11 | yield $violationList; |
|
| 46 | 11 | } |
|
| 48 |