Code Duplication    Length = 9-9 lines in 4 locations

src/Assert.php 4 locations

@@ 705-713 (lines=9) @@
702
     *
703
     * @throws InvalidArgumentException
704
     */
705
    public static function ip($value, $message = '')
706
    {
707
        if (false === \filter_var($value, \FILTER_VALIDATE_IP)) {
708
            static::reportInvalidArgument(\sprintf(
709
                $message ?: 'Expected a value to be an IP. Got: %s',
710
                static::valueToString($value)
711
            ));
712
        }
713
    }
714
715
    /**
716
     * @param mixed  $value
@@ 721-729 (lines=9) @@
718
     *
719
     * @throws InvalidArgumentException
720
     */
721
    public static function ipv4($value, $message = '')
722
    {
723
        if (false === \filter_var($value, \FILTER_VALIDATE_IP, \FILTER_FLAG_IPV4)) {
724
            static::reportInvalidArgument(\sprintf(
725
                $message ?: 'Expected a value to be an IPv4. Got: %s',
726
                static::valueToString($value)
727
            ));
728
        }
729
    }
730
731
    /**
732
     * @param mixed  $value
@@ 737-745 (lines=9) @@
734
     *
735
     * @throws InvalidArgumentException
736
     */
737
    public static function ipv6($value, $message = '')
738
    {
739
        if (false === \filter_var($value, \FILTER_VALIDATE_IP, \FILTER_FLAG_IPV6)) {
740
            static::reportInvalidArgument(\sprintf(
741
                $message ?: 'Expected a value to be an IPv6. Got: %s',
742
                static::valueToString($value)
743
            ));
744
        }
745
    }
746
747
    /**
748
     * @param mixed  $value
@@ 753-761 (lines=9) @@
750
     *
751
     * @throws InvalidArgumentException
752
     */
753
    public static function email($value, $message = '')
754
    {
755
        if (false === \filter_var($value, FILTER_VALIDATE_EMAIL)) {
756
            static::reportInvalidArgument(\sprintf(
757
                $message ?: 'Expected a value to be a valid e-mail address. Got: %s',
758
                static::valueToString($value)
759
            ));
760
        }
761
    }
762
763
    /**
764
     * Does non strict comparisons on the items, so ['3', 3] will not pass the assertion.