| Conditions | 3 |
| Paths | 3 |
| Total Lines | 14 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 3 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php declare(strict_types=1); |
||
| 21 | 9 | public function validate(array $rule): ConstraintViolationListInterface |
|
| 22 | { |
||
| 23 | 9 | $validator = Validation::createValidator(); |
|
| 24 | |||
| 25 | 9 | if (($errors = (new MinConstraintValidator)->validate($rule['min'] ?? null))->count()) { |
|
| 26 | 2 | return $errors; |
|
| 27 | } |
||
| 28 | |||
| 29 | 7 | if (($errors = (new MaxConstraintValidator)->validate($rule['max'] ?? null))->count()) { |
|
| 30 | 3 | return $errors; |
|
| 31 | } |
||
| 32 | |||
| 33 | 4 | return $validator->validate($rule['max'], [ |
|
| 34 | 4 | new GreaterThanOrEqual($rule['min']), |
|
| 35 | ]); |
||
| 38 |