@@ 627-637 (lines=11) @@ | ||
624 | } |
|
625 | } |
|
626 | ||
627 | public static function range($value, $min, $max, $message = '') |
|
628 | { |
|
629 | if ($value < $min || $value > $max) { |
|
630 | static::reportInvalidArgument(sprintf( |
|
631 | $message ?: 'Expected a value between %2$s and %3$s. Got: %s', |
|
632 | static::valueToString($value), |
|
633 | static::valueToString($min), |
|
634 | static::valueToString($max) |
|
635 | )); |
|
636 | } |
|
637 | } |
|
638 | ||
639 | public static function oneOf($value, array $values, $message = '') |
|
640 | { |
|
@@ 853-865 (lines=13) @@ | ||
850 | } |
|
851 | } |
|
852 | ||
853 | public static function lengthBetween($value, $min, $max, $message = '') |
|
854 | { |
|
855 | $length = static::strlen($value); |
|
856 | ||
857 | if ($length < $min || $length > $max) { |
|
858 | static::reportInvalidArgument(sprintf( |
|
859 | $message ?: 'Expected a value to contain between %2$s and %3$s characters. Got: %s', |
|
860 | static::valueToString($value), |
|
861 | $min, |
|
862 | $max |
|
863 | )); |
|
864 | } |
|
865 | } |
|
866 | ||
867 | public static function fileExists($value, $message = '') |
|
868 | { |