| @@ 535-545 (lines=11) @@ | ||
| 532 | } |
|
| 533 | } |
|
| 534 | ||
| 535 | public static function range($value, $min, $max, $message = '') |
|
| 536 | { |
|
| 537 | if ($value < $min || $value > $max) { |
|
| 538 | static::reportInvalidArgument(sprintf( |
|
| 539 | $message ?: 'Expected a value between %2$s and %3$s. Got: %s', |
|
| 540 | static::valueToString($value), |
|
| 541 | static::valueToString($min), |
|
| 542 | static::valueToString($max) |
|
| 543 | )); |
|
| 544 | } |
|
| 545 | } |
|
| 546 | ||
| 547 | public static function oneOf($value, array $values, $message = '') |
|
| 548 | { |
|
| @@ 761-773 (lines=13) @@ | ||
| 758 | } |
|
| 759 | } |
|
| 760 | ||
| 761 | public static function lengthBetween($value, $min, $max, $message = '') |
|
| 762 | { |
|
| 763 | $length = static::strlen($value); |
|
| 764 | ||
| 765 | if ($length < $min || $length > $max) { |
|
| 766 | static::reportInvalidArgument(sprintf( |
|
| 767 | $message ?: 'Expected a value to contain between %2$s and %3$s characters. Got: %s', |
|
| 768 | static::valueToString($value), |
|
| 769 | $min, |
|
| 770 | $max |
|
| 771 | )); |
|
| 772 | } |
|
| 773 | } |
|
| 774 | ||
| 775 | public static function fileExists($value, $message = '') |
|
| 776 | { |
|