| @@ 601-611 (lines=11) @@ | ||
| 598 | } |
|
| 599 | } |
|
| 600 | ||
| 601 | public static function range($value, $min, $max, $message = '') |
|
| 602 | { |
|
| 603 | if ($value < $min || $value > $max) { |
|
| 604 | static::reportInvalidArgument(sprintf( |
|
| 605 | $message ?: 'Expected a value between %2$s and %3$s. Got: %s', |
|
| 606 | static::valueToString($value), |
|
| 607 | static::valueToString($min), |
|
| 608 | static::valueToString($max) |
|
| 609 | )); |
|
| 610 | } |
|
| 611 | } |
|
| 612 | ||
| 613 | public static function oneOf($value, array $values, $message = '') |
|
| 614 | { |
|
| @@ 827-839 (lines=13) @@ | ||
| 824 | } |
|
| 825 | } |
|
| 826 | ||
| 827 | public static function lengthBetween($value, $min, $max, $message = '') |
|
| 828 | { |
|
| 829 | $length = static::strlen($value); |
|
| 830 | ||
| 831 | if ($length < $min || $length > $max) { |
|
| 832 | static::reportInvalidArgument(sprintf( |
|
| 833 | $message ?: 'Expected a value to contain between %2$s and %3$s characters. Got: %s', |
|
| 834 | static::valueToString($value), |
|
| 835 | $min, |
|
| 836 | $max |
|
| 837 | )); |
|
| 838 | } |
|
| 839 | } |
|
| 840 | ||
| 841 | public static function fileExists($value, $message = '') |
|
| 842 | { |
|