@@ 535-545 (lines=11) @@ | ||
532 | } |
|
533 | } |
|
534 | ||
535 | public static function range($value, $min, $max, $message = '') |
|
536 | { |
|
537 | if ($value < $min || $value > $max) { |
|
538 | static::reportInvalidArgument(sprintf( |
|
539 | $message ?: 'Expected a value between %2$s and %3$s. Got: %s', |
|
540 | static::valueToString($value), |
|
541 | static::valueToString($min), |
|
542 | static::valueToString($max) |
|
543 | )); |
|
544 | } |
|
545 | } |
|
546 | ||
547 | public static function oneOf($value, array $values, $message = '') |
|
548 | { |
|
@@ 759-771 (lines=13) @@ | ||
756 | } |
|
757 | } |
|
758 | ||
759 | public static function lengthBetween($value, $min, $max, $message = '') |
|
760 | { |
|
761 | $length = static::strlen($value); |
|
762 | ||
763 | if ($length < $min || $length > $max) { |
|
764 | static::reportInvalidArgument(sprintf( |
|
765 | $message ?: 'Expected a value to contain between %2$s and %3$s characters. Got: %s', |
|
766 | static::valueToString($value), |
|
767 | $min, |
|
768 | $max |
|
769 | )); |
|
770 | } |
|
771 | } |
|
772 | ||
773 | public static function fileExists($value, $message = '') |
|
774 | { |