@@ 469-479 (lines=11) @@ | ||
466 | } |
|
467 | } |
|
468 | ||
469 | public static function range($value, $min, $max, $message = '') |
|
470 | { |
|
471 | if ($value < $min || $value > $max) { |
|
472 | static::reportInvalidArgument(sprintf( |
|
473 | $message ?: 'Expected a value between %2$s and %3$s. Got: %s', |
|
474 | static::valueToString($value), |
|
475 | static::valueToString($min), |
|
476 | static::valueToString($max) |
|
477 | )); |
|
478 | } |
|
479 | } |
|
480 | ||
481 | public static function oneOf($value, array $values, $message = '') |
|
482 | { |
|
@@ 662-674 (lines=13) @@ | ||
659 | } |
|
660 | } |
|
661 | ||
662 | public static function lengthBetween($value, $min, $max, $message = '') |
|
663 | { |
|
664 | $length = static::strlen($value); |
|
665 | ||
666 | if ($length < $min || $length > $max) { |
|
667 | static::reportInvalidArgument(sprintf( |
|
668 | $message ?: 'Expected a value to contain between %2$s and %3$s characters. Got: %s', |
|
669 | static::valueToString($value), |
|
670 | $min, |
|
671 | $max |
|
672 | )); |
|
673 | } |
|
674 | } |
|
675 | ||
676 | public static function fileExists($value, $message = '') |
|
677 | { |