| @@ 604-614 (lines=11) @@ | ||
| 601 | } |
|
| 602 | } |
|
| 603 | ||
| 604 | public static function range($value, $min, $max, $message = '') |
|
| 605 | { |
|
| 606 | if ($value < $min || $value > $max) { |
|
| 607 | static::reportInvalidArgument(\sprintf( |
|
| 608 | $message ?: 'Expected a value between %2$s and %3$s. Got: %s', |
|
| 609 | static::valueToString($value), |
|
| 610 | static::valueToString($min), |
|
| 611 | static::valueToString($max) |
|
| 612 | )); |
|
| 613 | } |
|
| 614 | } |
|
| 615 | ||
| 616 | public static function oneOf($value, array $values, $message = '') |
|
| 617 | { |
|
| @@ 830-842 (lines=13) @@ | ||
| 827 | } |
|
| 828 | } |
|
| 829 | ||
| 830 | public static function lengthBetween($value, $min, $max, $message = '') |
|
| 831 | { |
|
| 832 | $length = static::strlen($value); |
|
| 833 | ||
| 834 | if ($length < $min || $length > $max) { |
|
| 835 | static::reportInvalidArgument(\sprintf( |
|
| 836 | $message ?: 'Expected a value to contain between %2$s and %3$s characters. Got: %s', |
|
| 837 | static::valueToString($value), |
|
| 838 | $min, |
|
| 839 | $max |
|
| 840 | )); |
|
| 841 | } |
|
| 842 | } |
|
| 843 | ||
| 844 | public static function fileExists($value, $message = '') |
|
| 845 | { |
|