Conditions | 4 |
Paths | 2 |
Total Lines | 11 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 4 |
Changes | 0 |
1 | <?php |
||
45 | 105 | public static function assertRange(int $value, int $min, int $max, string $message = ''): void |
|
46 | { |
||
47 | 105 | if ($value < $min || $value > $max) { |
|
48 | 45 | $format = $message ?: 'Expected a value between %2$s and %3$s. Got: %1$s'; |
|
49 | 45 | $message = sprintf( |
|
50 | 45 | $format, |
|
51 | 45 | self::valueToString($value), |
|
52 | 45 | self::valueToString($min), |
|
53 | 45 | self::valueToString($max) |
|
54 | ); |
||
55 | 45 | throw new InvalidArgumentException($message); |
|
56 | } |
||
59 |