@@ 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 | { |
|
@@ 760-772 (lines=13) @@ | ||
757 | } |
|
758 | } |
|
759 | ||
760 | public static function lengthBetween($value, $min, $max, $message = '') |
|
761 | { |
|
762 | $length = static::strlen($value); |
|
763 | ||
764 | if ($length < $min || $length > $max) { |
|
765 | static::reportInvalidArgument(sprintf( |
|
766 | $message ?: 'Expected a value to contain between %2$s and %3$s characters. Got: %s', |
|
767 | static::valueToString($value), |
|
768 | $min, |
|
769 | $max |
|
770 | )); |
|
771 | } |
|
772 | } |
|
773 | ||
774 | public static function fileExists($value, $message = '') |
|
775 | { |