@@ 462-472 (lines=11) @@ | ||
459 | } |
|
460 | } |
|
461 | ||
462 | public static function range($value, $min, $max, $message = '') |
|
463 | { |
|
464 | if ($value < $min || $value > $max) { |
|
465 | static::reportInvalidArgument(sprintf( |
|
466 | $message ?: 'Expected a value between %2$s and %3$s. Got: %s', |
|
467 | static::valueToString($value), |
|
468 | static::valueToString($min), |
|
469 | static::valueToString($max) |
|
470 | )); |
|
471 | } |
|
472 | } |
|
473 | ||
474 | public static function oneOf($value, array $values, $message = '') |
|
475 | { |
|
@@ 655-667 (lines=13) @@ | ||
652 | } |
|
653 | } |
|
654 | ||
655 | public static function lengthBetween($value, $min, $max, $message = '') |
|
656 | { |
|
657 | $length = static::strlen($value); |
|
658 | ||
659 | if ($length < $min || $length > $max) { |
|
660 | static::reportInvalidArgument(sprintf( |
|
661 | $message ?: 'Expected a value to contain between %2$s and %3$s characters. Got: %s', |
|
662 | static::valueToString($value), |
|
663 | $min, |
|
664 | $max |
|
665 | )); |
|
666 | } |
|
667 | } |
|
668 | ||
669 | public static function fileExists($value, $message = '') |
|
670 | { |