Code Duplication    Length = 9-9 lines in 5 locations

src/Assert.php 5 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
@@ 901-909 (lines=9) @@
898
     *
899
     * @throws InvalidArgumentException
900
     */
901
    public static function url($value, $message = '')
902
    {
903
        if (false === \filter_var($value, FILTER_VALIDATE_URL)) {
904
            static::reportInvalidArgument(\sprintf(
905
                $message ?: 'Expected a value to be a valid URL. Got %s',
906
                static::valueToString($value)
907
            ));
908
        }
909
    }
910
911
    /**
912
     * @param mixed  $value
@@ 917-925 (lines=9) @@
914
     *
915
     * @throws InvalidArgumentException
916
     */
917
    public static function email($value, $message = '')
918
    {
919
        if (false === \filter_var($value, FILTER_VALIDATE_EMAIL)) {
920
            static::reportInvalidArgument(\sprintf(
921
                $message ?: 'Expected a value to be a valid e-mail address. Got: %s',
922
                static::valueToString($value)
923
            ));
924
        }
925
    }
926
927
    /**
928
     * Does non strict comparisons on the items, so ['3', 3] will not pass the assertion.