@@ 606-616 (lines=11) @@ | ||
603 | } |
|
604 | } |
|
605 | ||
606 | public static function range($value, $min, $max, $message = '') |
|
607 | { |
|
608 | if ($value < $min || $value > $max) { |
|
609 | static::reportInvalidArgument(sprintf( |
|
610 | $message ?: 'Expected a value between %2$s and %3$s. Got: %s', |
|
611 | static::valueToString($value), |
|
612 | static::valueToString($min), |
|
613 | static::valueToString($max) |
|
614 | )); |
|
615 | } |
|
616 | } |
|
617 | ||
618 | public static function oneOf($value, array $values, $message = '') |
|
619 | { |
|
@@ 842-854 (lines=13) @@ | ||
839 | } |
|
840 | } |
|
841 | ||
842 | public static function lengthBetween($value, $min, $max, $message = '') |
|
843 | { |
|
844 | $length = static::strlen($value); |
|
845 | ||
846 | if ($length < $min || $length > $max) { |
|
847 | static::reportInvalidArgument(sprintf( |
|
848 | $message ?: 'Expected a value to contain between %2$s and %3$s characters. Got: %s', |
|
849 | static::valueToString($value), |
|
850 | $min, |
|
851 | $max |
|
852 | )); |
|
853 | } |
|
854 | } |
|
855 | ||
856 | public static function fileExists($value, $message = '') |
|
857 | { |