| @@ 491-501 (lines=11) @@ | ||
| 488 | } |
|
| 489 | } |
|
| 490 | ||
| 491 | public static function range($value, $min, $max, $message = '') |
|
| 492 | { |
|
| 493 | if ($value < $min || $value > $max) { |
|
| 494 | static::reportInvalidArgument(sprintf( |
|
| 495 | $message ?: 'Expected a value between %2$s and %3$s. Got: %s', |
|
| 496 | static::valueToString($value), |
|
| 497 | static::valueToString($min), |
|
| 498 | static::valueToString($max) |
|
| 499 | )); |
|
| 500 | } |
|
| 501 | } |
|
| 502 | ||
| 503 | public static function oneOf($value, array $values, $message = '') |
|
| 504 | { |
|
| @@ 694-706 (lines=13) @@ | ||
| 691 | } |
|
| 692 | } |
|
| 693 | ||
| 694 | public static function lengthBetween($value, $min, $max, $message = '') |
|
| 695 | { |
|
| 696 | $length = static::strlen($value); |
|
| 697 | ||
| 698 | if ($length < $min || $length > $max) { |
|
| 699 | static::reportInvalidArgument(sprintf( |
|
| 700 | $message ?: 'Expected a value to contain between %2$s and %3$s characters. Got: %s', |
|
| 701 | static::valueToString($value), |
|
| 702 | $min, |
|
| 703 | $max |
|
| 704 | )); |
|
| 705 | } |
|
| 706 | } |
|
| 707 | ||
| 708 | public static function fileExists($value, $message = '') |
|
| 709 | { |
|