@@ 539-549 (lines=11) @@ | ||
536 | } |
|
537 | } |
|
538 | ||
539 | public static function range($value, $min, $max, $message = '') |
|
540 | { |
|
541 | if ($value < $min || $value > $max) { |
|
542 | static::reportInvalidArgument(sprintf( |
|
543 | $message ?: 'Expected a value between %2$s and %3$s. Got: %s', |
|
544 | static::valueToString($value), |
|
545 | static::valueToString($min), |
|
546 | static::valueToString($max) |
|
547 | )); |
|
548 | } |
|
549 | } |
|
550 | ||
551 | public static function oneOf($value, array $values, $message = '') |
|
552 | { |
|
@@ 787-799 (lines=13) @@ | ||
784 | } |
|
785 | } |
|
786 | ||
787 | public static function lengthBetween($value, $min, $max, $message = '') |
|
788 | { |
|
789 | $length = static::strlen($value); |
|
790 | ||
791 | if ($length < $min || $length > $max) { |
|
792 | static::reportInvalidArgument(sprintf( |
|
793 | $message ?: 'Expected a value to contain between %2$s and %3$s characters. Got: %s', |
|
794 | static::valueToString($value), |
|
795 | $min, |
|
796 | $max |
|
797 | )); |
|
798 | } |
|
799 | } |
|
800 | ||
801 | public static function fileExists($value, $message = '') |
|
802 | { |