Code Duplication    Length = 10-10 lines in 4 locations

src/Assert.php 4 locations

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