@@ 450-460 (lines=11) @@ | ||
447 | } |
|
448 | } |
|
449 | ||
450 | public static function range($value, $min, $max, $message = '') |
|
451 | { |
|
452 | if ($value < $min || $value > $max) { |
|
453 | static::reportInvalidArgument(sprintf( |
|
454 | $message ?: 'Expected a value between %2$s and %3$s. Got: %s', |
|
455 | static::valueToString($value), |
|
456 | static::valueToString($min), |
|
457 | static::valueToString($max) |
|
458 | )); |
|
459 | } |
|
460 | } |
|
461 | ||
462 | public static function oneOf($value, array $values, $message = '') |
|
463 | { |
|
@@ 643-655 (lines=13) @@ | ||
640 | } |
|
641 | } |
|
642 | ||
643 | public static function lengthBetween($value, $min, $max, $message = '') |
|
644 | { |
|
645 | $length = static::strlen($value); |
|
646 | ||
647 | if ($length < $min || $length > $max) { |
|
648 | static::reportInvalidArgument(sprintf( |
|
649 | $message ?: 'Expected a value to contain between %2$s and %3$s characters. Got: %s', |
|
650 | static::valueToString($value), |
|
651 | $min, |
|
652 | $max |
|
653 | )); |
|
654 | } |
|
655 | } |
|
656 | ||
657 | public static function fileExists($value, $message = '') |
|
658 | { |