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