| @@ 533-543 (lines=11) @@ | ||
| 530 | } |
|
| 531 | } |
|
| 532 | ||
| 533 | public static function range($value, $min, $max, $message = '') |
|
| 534 | { |
|
| 535 | if ($value < $min || $value > $max) { |
|
| 536 | static::reportInvalidArgument(sprintf( |
|
| 537 | $message ?: 'Expected a value between %2$s and %3$s. Got: %s', |
|
| 538 | static::valueToString($value), |
|
| 539 | static::valueToString($min), |
|
| 540 | static::valueToString($max) |
|
| 541 | )); |
|
| 542 | } |
|
| 543 | } |
|
| 544 | ||
| 545 | public static function oneOf($value, array $values, $message = '') |
|
| 546 | { |
|
| @@ 747-759 (lines=13) @@ | ||
| 744 | } |
|
| 745 | } |
|
| 746 | ||
| 747 | public static function lengthBetween($value, $min, $max, $message = '') |
|
| 748 | { |
|
| 749 | $length = static::strlen($value); |
|
| 750 | ||
| 751 | if ($length < $min || $length > $max) { |
|
| 752 | static::reportInvalidArgument(sprintf( |
|
| 753 | $message ?: 'Expected a value to contain between %2$s and %3$s characters. Got: %s', |
|
| 754 | static::valueToString($value), |
|
| 755 | $min, |
|
| 756 | $max |
|
| 757 | )); |
|
| 758 | } |
|
| 759 | } |
|
| 760 | ||
| 761 | public static function fileExists($value, $message = '') |
|
| 762 | { |
|