Conditions | 6 |
Paths | 4 |
Total Lines | 14 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 6 |
Changes | 0 |
1 | <?php |
||
23 | 7 | public function __construct(int $min, ?int $max = null) |
|
24 | { |
||
25 | 7 | if ($min < 0) { |
|
26 | 1 | throw new InvalidArgumentException('Min cannot be negative.'); |
|
27 | } |
||
28 | 6 | if ($max !== null && $max < $min) { |
|
29 | 1 | throw new InvalidArgumentException('Max cannot be smaller than min.'); |
|
30 | } |
||
31 | 5 | if ($min === 0 && $max === null) { |
|
32 | 1 | throw new InvalidArgumentException('Min cannot be zero when max is unconstrained.'); |
|
33 | } |
||
34 | |||
35 | 4 | $this->min = $min; |
|
36 | 4 | $this->max = $max; |
|
37 | 4 | } |
|
72 |