@@ 583-593 (lines=11) @@ | ||
580 | } |
|
581 | } |
|
582 | ||
583 | public static function range($value, $min, $max, $message = '') |
|
584 | { |
|
585 | if ($value < $min || $value > $max) { |
|
586 | static::reportInvalidArgument(sprintf( |
|
587 | $message ?: 'Expected a value between %2$s and %3$s. Got: %s', |
|
588 | static::valueToString($value), |
|
589 | static::valueToString($min), |
|
590 | static::valueToString($max) |
|
591 | )); |
|
592 | } |
|
593 | } |
|
594 | ||
595 | public static function oneOf($value, array $values, $message = '') |
|
596 | { |
|
@@ 809-821 (lines=13) @@ | ||
806 | } |
|
807 | } |
|
808 | ||
809 | public static function lengthBetween($value, $min, $max, $message = '') |
|
810 | { |
|
811 | $length = static::strlen($value); |
|
812 | ||
813 | if ($length < $min || $length > $max) { |
|
814 | static::reportInvalidArgument(sprintf( |
|
815 | $message ?: 'Expected a value to contain between %2$s and %3$s characters. Got: %s', |
|
816 | static::valueToString($value), |
|
817 | $min, |
|
818 | $max |
|
819 | )); |
|
820 | } |
|
821 | } |
|
822 | ||
823 | public static function fileExists($value, $message = '') |
|
824 | { |