Code Duplication    Length = 9-9 lines in 4 locations

src/Assert.php 4 locations

@@ 793-801 (lines=9) @@
790
     *
791
     * @throws InvalidArgumentException
792
     */
793
    public static function ip($value, $message = '')
794
    {
795
        if (false === \filter_var($value, \FILTER_VALIDATE_IP)) {
796
            static::reportInvalidArgument(\sprintf(
797
                $message ?: 'Expected a value to be an IP. Got: %s',
798
                static::valueToString($value)
799
            ));
800
        }
801
    }
802
803
    /**
804
     * @param mixed  $value
@@ 809-817 (lines=9) @@
806
     *
807
     * @throws InvalidArgumentException
808
     */
809
    public static function ipv4($value, $message = '')
810
    {
811
        if (false === \filter_var($value, \FILTER_VALIDATE_IP, \FILTER_FLAG_IPV4)) {
812
            static::reportInvalidArgument(\sprintf(
813
                $message ?: 'Expected a value to be an IPv4. Got: %s',
814
                static::valueToString($value)
815
            ));
816
        }
817
    }
818
819
    /**
820
     * @param mixed  $value
@@ 825-833 (lines=9) @@
822
     *
823
     * @throws InvalidArgumentException
824
     */
825
    public static function ipv6($value, $message = '')
826
    {
827
        if (false === \filter_var($value, \FILTER_VALIDATE_IP, \FILTER_FLAG_IPV6)) {
828
            static::reportInvalidArgument(\sprintf(
829
                $message ?: 'Expected a value to be an IPv6. Got %s',
830
                static::valueToString($value)
831
            ));
832
        }
833
    }
834
835
    /**
836
     * @param mixed  $value
@@ 841-849 (lines=9) @@
838
     *
839
     * @throws InvalidArgumentException
840
     */
841
    public static function email($value, $message = '')
842
    {
843
        if (false === \filter_var($value, FILTER_VALIDATE_EMAIL)) {
844
            static::reportInvalidArgument(\sprintf(
845
                $message ?: 'Expected a value to be a valid e-mail address. Got %s',
846
                static::valueToString($value)
847
            ));
848
        }
849
    }
850
851
    /**
852
     * Does non strict comparisons on the items, so ['3', 3] will not pass the assertion.