@@ 573-583 (lines=11) @@ | ||
570 | } |
|
571 | } |
|
572 | ||
573 | public static function range($value, $min, $max, $message = '') |
|
574 | { |
|
575 | if ($value < $min || $value > $max) { |
|
576 | static::reportInvalidArgument(sprintf( |
|
577 | $message ?: 'Expected a value between %2$s and %3$s. Got: %s', |
|
578 | static::valueToString($value), |
|
579 | static::valueToString($min), |
|
580 | static::valueToString($max) |
|
581 | )); |
|
582 | } |
|
583 | } |
|
584 | ||
585 | public static function oneOf($value, array $values, $message = '') |
|
586 | { |
|
@@ 799-811 (lines=13) @@ | ||
796 | } |
|
797 | } |
|
798 | ||
799 | public static function lengthBetween($value, $min, $max, $message = '') |
|
800 | { |
|
801 | $length = static::strlen($value); |
|
802 | ||
803 | if ($length < $min || $length > $max) { |
|
804 | static::reportInvalidArgument(sprintf( |
|
805 | $message ?: 'Expected a value to contain between %2$s and %3$s characters. Got: %s', |
|
806 | static::valueToString($value), |
|
807 | $min, |
|
808 | $max |
|
809 | )); |
|
810 | } |
|
811 | } |
|
812 | ||
813 | public static function fileExists($value, $message = '') |
|
814 | { |