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