| @@ 842-854 (lines=13) @@ | ||
| 839 | } |
|
| 840 | } |
|
| 841 | ||
| 842 | public static function lengthBetween($value, $min, $max, $message = '') |
|
| 843 | { |
|
| 844 | $length = static::strlen($value); |
|
| 845 | ||
| 846 | if ($length < $min || $length > $max) { |
|
| 847 | static::reportInvalidArgument(sprintf( |
|
| 848 | $message ?: 'Expected a value to contain between %2$s and %3$s characters. Got: %s', |
|
| 849 | static::valueToString($value), |
|
| 850 | $min, |
|
| 851 | $max |
|
| 852 | )); |
|
| 853 | } |
|
| 854 | } |
|
| 855 | ||
| 856 | public static function fileExists($value, $message = '') |
|
| 857 | { |
|
| @@ 616-626 (lines=11) @@ | ||
| 613 | } |
|
| 614 | } |
|
| 615 | ||
| 616 | public static function range($value, $min, $max, $message = '') |
|
| 617 | { |
|
| 618 | if ($value < $min || $value > $max) { |
|
| 619 | static::reportInvalidArgument(sprintf( |
|
| 620 | $message ?: 'Expected a value between %2$s and %3$s. Got: %s', |
|
| 621 | static::valueToString($value), |
|
| 622 | static::valueToString($min), |
|
| 623 | static::valueToString($max) |
|
| 624 | )); |
|
| 625 | } |
|
| 626 | } |
|
| 627 | ||
| 628 | public static function oneOf($value, array $values, $message = '') |
|
| 629 | { |
|