Conditions | 4 |
Paths | 3 |
Total Lines | 11 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 4 |
Changes | 0 |
1 | <?php |
||
27 | 7 | public function __construct(int $minLength = 3, ?int $maxLength = 25) |
|
28 | { |
||
29 | 7 | if ($minLength < 1) { |
|
30 | 2 | throw new InvalidArgumentException('Min length must be positive.'); |
|
31 | } |
||
32 | 5 | if ($maxLength !== null && $maxLength < $minLength) { |
|
33 | 1 | throw new InvalidArgumentException('Max length cannot be smaller than min length.'); |
|
34 | } |
||
35 | |||
36 | 4 | $this->minLength = $minLength; |
|
37 | 4 | $this->maxLength = $maxLength; |
|
38 | 4 | } |
|
54 |