@@ 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 | { |
|
@@ 783-795 (lines=13) @@ | ||
780 | } |
|
781 | } |
|
782 | ||
783 | public static function lengthBetween($value, $min, $max, $message = '') |
|
784 | { |
|
785 | $length = static::strlen($value); |
|
786 | ||
787 | if ($length < $min || $length > $max) { |
|
788 | static::reportInvalidArgument(sprintf( |
|
789 | $message ?: 'Expected a value to contain between %2$s and %3$s characters. Got: %s', |
|
790 | static::valueToString($value), |
|
791 | $min, |
|
792 | $max |
|
793 | )); |
|
794 | } |
|
795 | } |
|
796 | ||
797 | public static function fileExists($value, $message = '') |
|
798 | { |