| Conditions | 5 |
| Paths | 4 |
| Total Lines | 19 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php declare(strict_types=1); |
||
| 15 | public function validate($input, Constraint $constraint): void |
||
| 16 | { |
||
| 17 | if (!$constraint instanceof Limit) { |
||
| 18 | throw new Exception\UnexpectedTypeException($constraint, Limit::class); // @codeCoverageIgnore |
||
| 19 | } |
||
| 20 | |||
| 21 | if (!$input instanceof InputInterface) { |
||
| 22 | throw new Exception\UnexpectedTypeException($input, InputInterface::class); // @codeCoverageIgnore |
||
| 23 | } |
||
| 24 | |||
| 25 | if ($input->getLimit() >= $constraint->min && $input->getLimit() <= $constraint->max) { |
||
| 26 | return; |
||
| 27 | } |
||
| 28 | |||
| 29 | $this->context |
||
| 30 | ->buildViolation($constraint->message) |
||
| 31 | ->atPath('limit') |
||
| 32 | ->setParameter('{{ value }}', (string) $input->getLimit()) |
||
| 33 | ->addViolation(); |
||
| 34 | } |
||
| 36 |