Code Duplication    Length = 9-9 lines in 4 locations

src/Assert.php 4 locations

@@ 851-859 (lines=9) @@
848
     *
849
     * @throws InvalidArgumentException
850
     */
851
    public static function ip($value, $message = '')
852
    {
853
        if (false === \filter_var($value, \FILTER_VALIDATE_IP)) {
854
            static::reportInvalidArgument(\sprintf(
855
                $message ?: 'Expected a value to be an IP. Got: %s',
856
                static::valueToString($value)
857
            ));
858
        }
859
    }
860
861
    /**
862
     * @param mixed  $value
@@ 867-875 (lines=9) @@
864
     *
865
     * @throws InvalidArgumentException
866
     */
867
    public static function ipv4($value, $message = '')
868
    {
869
        if (false === \filter_var($value, \FILTER_VALIDATE_IP, \FILTER_FLAG_IPV4)) {
870
            static::reportInvalidArgument(\sprintf(
871
                $message ?: 'Expected a value to be an IPv4. Got: %s',
872
                static::valueToString($value)
873
            ));
874
        }
875
    }
876
877
    /**
878
     * @param mixed  $value
@@ 883-891 (lines=9) @@
880
     *
881
     * @throws InvalidArgumentException
882
     */
883
    public static function ipv6($value, $message = '')
884
    {
885
        if (false === \filter_var($value, \FILTER_VALIDATE_IP, \FILTER_FLAG_IPV6)) {
886
            static::reportInvalidArgument(\sprintf(
887
                $message ?: 'Expected a value to be an IPv6. Got: %s',
888
                static::valueToString($value)
889
            ));
890
        }
891
    }
892
893
    /**
894
     * @psalm-pure
@@ 937-945 (lines=9) @@
934
     *
935
     * @throws InvalidArgumentException
936
     */
937
    public static function email($value, $message = '')
938
    {
939
        if (false === \filter_var($value, FILTER_VALIDATE_EMAIL)) {
940
            static::reportInvalidArgument(\sprintf(
941
                $message ?: 'Expected a value to be a valid e-mail address. Got: %s',
942
                static::valueToString($value)
943
            ));
944
        }
945
    }
946
947
    /**
948
     * Does non strict comparisons on the items, so ['3', 3] will not pass the assertion.