| @@ 606-616 (lines=11) @@ | ||
| 603 | } |
|
| 604 | } |
|
| 605 | ||
| 606 | public static function range($value, $min, $max, $message = '') |
|
| 607 | { |
|
| 608 | if ($value < $min || $value > $max) { |
|
| 609 | static::reportInvalidArgument(sprintf( |
|
| 610 | $message ?: 'Expected a value between %2$s and %3$s. Got: %s', |
|
| 611 | static::valueToString($value), |
|
| 612 | static::valueToString($min), |
|
| 613 | static::valueToString($max) |
|
| 614 | )); |
|
| 615 | } |
|
| 616 | } |
|
| 617 | ||
| 618 | public static function oneOf($value, array $values, $message = '') |
|
| 619 | { |
|
| @@ 844-856 (lines=13) @@ | ||
| 841 | } |
|
| 842 | } |
|
| 843 | ||
| 844 | public static function lengthBetween($value, $min, $max, $message = '') |
|
| 845 | { |
|
| 846 | $length = static::strlen($value); |
|
| 847 | ||
| 848 | if ($length < $min || $length > $max) { |
|
| 849 | static::reportInvalidArgument(sprintf( |
|
| 850 | $message ?: 'Expected a value to contain between %2$s and %3$s characters. Got: %s', |
|
| 851 | static::valueToString($value), |
|
| 852 | $min, |
|
| 853 | $max |
|
| 854 | )); |
|
| 855 | } |
|
| 856 | } |
|
| 857 | ||
| 858 | public static function fileExists($value, $message = '') |
|
| 859 | { |
|