@@ 516-526 (lines=11) @@ | ||
513 | } |
|
514 | } |
|
515 | ||
516 | public static function range($value, $min, $max, $message = '') |
|
517 | { |
|
518 | if ($value < $min || $value > $max) { |
|
519 | static::reportInvalidArgument(sprintf( |
|
520 | $message ?: 'Expected a value between %2$s and %3$s. Got: %s', |
|
521 | static::valueToString($value), |
|
522 | static::valueToString($min), |
|
523 | static::valueToString($max) |
|
524 | )); |
|
525 | } |
|
526 | } |
|
527 | ||
528 | public static function oneOf($value, array $values, $message = '') |
|
529 | { |
|
@@ 730-742 (lines=13) @@ | ||
727 | } |
|
728 | } |
|
729 | ||
730 | public static function lengthBetween($value, $min, $max, $message = '') |
|
731 | { |
|
732 | $length = static::strlen($value); |
|
733 | ||
734 | if ($length < $min || $length > $max) { |
|
735 | static::reportInvalidArgument(sprintf( |
|
736 | $message ?: 'Expected a value to contain between %2$s and %3$s characters. Got: %s', |
|
737 | static::valueToString($value), |
|
738 | $min, |
|
739 | $max |
|
740 | )); |
|
741 | } |
|
742 | } |
|
743 | ||
744 | public static function fileExists($value, $message = '') |
|
745 | { |