Conditions | 3 |
Paths | 4 |
Total Lines | 21 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 3 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
17 | 1 | public function create(SymfonyConstraint $constraint): Constraint |
|
18 | { |
||
19 | /** @var Assert\Range $constraint */ |
||
20 | |||
21 | 1 | $options = []; |
|
22 | |||
23 | 1 | if (null !== $constraint->min) { |
|
24 | $options += [ |
||
25 | 1 | 'min' => $constraint->min, |
|
26 | 1 | 'minMessage' => $this->trans($constraint->minMessage, ['{{ limit }}' => $constraint->min]), |
|
27 | ]; |
||
28 | } |
||
29 | |||
30 | 1 | if (null !== $constraint->max) { |
|
31 | $options += [ |
||
32 | 1 | 'max' => $constraint->max, |
|
33 | 1 | 'maxMessage' => $this->trans($constraint->maxMessage, ['{{ limit }}' => $constraint->max]), |
|
34 | ]; |
||
35 | } |
||
36 | |||
37 | 1 | return new ParsleyAssert\Range($options); |
|
38 | } |
||
48 |