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