@@ 658-670 (lines=13) @@ | ||
655 | } |
|
656 | } |
|
657 | ||
658 | public static function lengthBetween($value, $min, $max, $message = '') |
|
659 | { |
|
660 | $length = static::strlen($value); |
|
661 | ||
662 | if ($length < $min || $length > $max) { |
|
663 | static::reportInvalidArgument(sprintf( |
|
664 | $message ?: 'Expected a value to contain between %2$s and %3$s characters. Got: %s', |
|
665 | static::valueToString($value), |
|
666 | $min, |
|
667 | $max |
|
668 | )); |
|
669 | } |
|
670 | } |
|
671 | ||
672 | public static function fileExists($value, $message = '') |
|
673 | { |
|
@@ 465-475 (lines=11) @@ | ||
462 | } |
|
463 | } |
|
464 | ||
465 | public static function range($value, $min, $max, $message = '') |
|
466 | { |
|
467 | if ($value < $min || $value > $max) { |
|
468 | static::reportInvalidArgument(sprintf( |
|
469 | $message ?: 'Expected a value between %2$s and %3$s. Got: %s', |
|
470 | static::valueToString($value), |
|
471 | static::valueToString($min), |
|
472 | static::valueToString($max) |
|
473 | )); |
|
474 | } |
|
475 | } |
|
476 | ||
477 | public static function oneOf($value, array $values, $message = '') |
|
478 | { |