Code Duplication    Length = 9-9 lines in 4 locations

src/Assert.php 4 locations

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