| Conditions | 4 |
| Paths | 3 |
| Total Lines | 11 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 4 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 29 | 70 | public static function assertRange(int $value, int $min, int $max, string $message = ''): void |
|
| 30 | { |
||
| 31 | 70 | if ($value < $min || $value > $max) { |
|
| 32 | 30 | $format = '' === $message ? 'Expected a value between %2$s and %3$s. Got: %1$s' : $message; |
|
| 33 | 30 | $message = sprintf( |
|
| 34 | 30 | $format, |
|
| 35 | 30 | self::valueToString($value), |
|
| 36 | 30 | self::valueToString($min), |
|
| 37 | 30 | self::valueToString($max) |
|
| 38 | 30 | ); |
|
| 39 | 30 | throw new InvalidArgumentException($message); |
|
| 40 | } |
||
| 43 |