@@ 704-712 (lines=9) @@ | ||
701 | * |
|
702 | * @throws InvalidArgumentException |
|
703 | */ |
|
704 | public static function ip($value, $message = '') |
|
705 | { |
|
706 | if (false === \filter_var($value, \FILTER_VALIDATE_IP)) { |
|
707 | static::reportInvalidArgument(\sprintf( |
|
708 | $message ?: 'Expected a value to be an IP. Got: %s', |
|
709 | static::valueToString($value) |
|
710 | )); |
|
711 | } |
|
712 | } |
|
713 | ||
714 | /** |
|
715 | * @param mixed $value |
|
@@ 752-760 (lines=9) @@ | ||
749 | * |
|
750 | * @throws InvalidArgumentException |
|
751 | */ |
|
752 | public static function email($value, $message = '') |
|
753 | { |
|
754 | if (false === \filter_var($value, FILTER_VALIDATE_EMAIL)) { |
|
755 | static::reportInvalidArgument(\sprintf( |
|
756 | $message ?: 'Expected a value to be a valid e-mail address. Got %s', |
|
757 | static::valueToString($value) |
|
758 | )); |
|
759 | } |
|
760 | } |
|
761 | ||
762 | /** |
|
763 | * Does non strict comparisons on the items, so ['3', 3] will not pass the assertion. |