Code Duplication    Length = 9-9 lines in 4 locations

src/Assert.php 4 locations

@@ 681-689 (lines=9) @@
678
     *
679
     * @throws InvalidArgumentException
680
     */
681
    public static function ip($value, $message = '')
682
    {
683
        if (false === \filter_var($value, \FILTER_VALIDATE_IP)) {
684
            static::reportInvalidArgument(\sprintf(
685
                $message ?: 'Expected a value to be an IP. Got: %s',
686
                static::valueToString($value)
687
            ));
688
        }
689
    }
690
691
    /**
692
     * @param mixed  $value
@@ 697-705 (lines=9) @@
694
     *
695
     * @throws InvalidArgumentException
696
     */
697
    public static function ipv4($value, $message = '')
698
    {
699
        if (false === \filter_var($value, \FILTER_VALIDATE_IP, \FILTER_FLAG_IPV4)) {
700
            static::reportInvalidArgument(\sprintf(
701
                $message ?: 'Expected a value to be an IPv4. Got: %s',
702
                static::valueToString($value)
703
            ));
704
        }
705
    }
706
707
    /**
708
     * @param mixed  $value
@@ 713-721 (lines=9) @@
710
     *
711
     * @throws InvalidArgumentException
712
     */
713
    public static function ipv6($value, $message = '')
714
    {
715
        if (false === \filter_var($value, \FILTER_VALIDATE_IP, \FILTER_FLAG_IPV6)) {
716
            static::reportInvalidArgument(\sprintf(
717
                $message ?: 'Expected a value to be an IPv6. Got: %s',
718
                static::valueToString($value)
719
            ));
720
        }
721
    }
722
723
    /**
724
     * @param mixed  $value
@@ 729-737 (lines=9) @@
726
     *
727
     * @throws InvalidArgumentException
728
     */
729
    public static function email($value, $message = '')
730
    {
731
        if (false === \filter_var($value, FILTER_VALIDATE_EMAIL)) {
732
            static::reportInvalidArgument(\sprintf(
733
                $message ?: 'Expected a value to be a valid e-mail address. Got: %s',
734
                static::valueToString($value)
735
            ));
736
        }
737
    }
738
739
    /**
740
     * Does non strict comparisons on the items, so ['3', 3] will not pass the assertion.