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