@@ 618-628 (lines=11) @@ | ||
615 | } |
|
616 | } |
|
617 | ||
618 | public static function range($value, $min, $max, $message = '') |
|
619 | { |
|
620 | if ($value < $min || $value > $max) { |
|
621 | static::reportInvalidArgument(sprintf( |
|
622 | $message ?: 'Expected a value between %2$s and %3$s. Got: %s', |
|
623 | static::valueToString($value), |
|
624 | static::valueToString($min), |
|
625 | static::valueToString($max) |
|
626 | )); |
|
627 | } |
|
628 | } |
|
629 | ||
630 | public static function oneOf($value, array $values, $message = '') |
|
631 | { |
|
@@ 856-868 (lines=13) @@ | ||
853 | } |
|
854 | } |
|
855 | ||
856 | public static function lengthBetween($value, $min, $max, $message = '') |
|
857 | { |
|
858 | $length = static::strlen($value); |
|
859 | ||
860 | if ($length < $min || $length > $max) { |
|
861 | static::reportInvalidArgument(sprintf( |
|
862 | $message ?: 'Expected a value to contain between %2$s and %3$s characters. Got: %s', |
|
863 | static::valueToString($value), |
|
864 | $min, |
|
865 | $max |
|
866 | )); |
|
867 | } |
|
868 | } |
|
869 | ||
870 | public static function fileExists($value, $message = '') |
|
871 | { |