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