Code Duplication    Length = 9-9 lines in 4 locations

src/Assert.php 4 locations

@@ 723-731 (lines=9) @@
720
     *
721
     * @throws InvalidArgumentException
722
     */
723
    public static function ip($value, $message = '')
724
    {
725
        if (false === \filter_var($value, \FILTER_VALIDATE_IP)) {
726
            static::reportInvalidArgument(\sprintf(
727
                $message ?: 'Expected a value to be an IP. Got: %s',
728
                static::valueToString($value)
729
            ));
730
        }
731
    }
732
733
    /**
734
     * @param mixed  $value
@@ 739-747 (lines=9) @@
736
     *
737
     * @throws InvalidArgumentException
738
     */
739
    public static function ipv4($value, $message = '')
740
    {
741
        if (false === \filter_var($value, \FILTER_VALIDATE_IP, \FILTER_FLAG_IPV4)) {
742
            static::reportInvalidArgument(\sprintf(
743
                $message ?: 'Expected a value to be an IPv4. Got: %s',
744
                static::valueToString($value)
745
            ));
746
        }
747
    }
748
749
    /**
750
     * @param mixed  $value
@@ 755-763 (lines=9) @@
752
     *
753
     * @throws InvalidArgumentException
754
     */
755
    public static function ipv6($value, $message = '')
756
    {
757
        if (false === \filter_var($value, \FILTER_VALIDATE_IP, \FILTER_FLAG_IPV6)) {
758
            static::reportInvalidArgument(\sprintf(
759
                $message ?: 'Expected a value to be an IPv6. Got %s',
760
                static::valueToString($value)
761
            ));
762
        }
763
    }
764
765
    /**
766
     * @param mixed  $value
@@ 771-779 (lines=9) @@
768
     *
769
     * @throws InvalidArgumentException
770
     */
771
    public static function email($value, $message = '')
772
    {
773
        if (false === \filter_var($value, FILTER_VALIDATE_EMAIL)) {
774
            static::reportInvalidArgument(\sprintf(
775
                $message ?: 'Expected a value to be a valid e-mail address. Got %s',
776
                static::valueToString($value)
777
            ));
778
        }
779
    }
780
781
    /**
782
     * Does non strict comparisons on the items, so ['3', 3] will not pass the assertion.