Code Duplication    Length = 10-10 lines in 4 locations

src/Assert.php 4 locations

@@ 697-706 (lines=10) @@
694
     *
695
     * @throws InvalidArgumentException
696
     */
697
    public static function ip($value, $message = '')
698
    {
699
        static::string($value, $message);
700
        if (false === \filter_var($value, \FILTER_VALIDATE_IP)) {
701
            static::reportInvalidArgument(\sprintf(
702
                $message ?: 'Expected a value to be an IP. Got: %s',
703
                static::valueToString($value)
704
            ));
705
        }
706
    }
707
708
    /**
709
     * @psalm-assert string $value
@@ 716-725 (lines=10) @@
713
     *
714
     * @throws InvalidArgumentException
715
     */
716
    public static function ipv4($value, $message = '')
717
    {
718
        static::string($value, $message);
719
        if (false === \filter_var($value, \FILTER_VALIDATE_IP, \FILTER_FLAG_IPV4)) {
720
            static::reportInvalidArgument(\sprintf(
721
                $message ?: 'Expected a value to be an IPv4. Got: %s',
722
                static::valueToString($value)
723
            ));
724
        }
725
    }
726
727
    /**
728
     * @psalm-assert string $value
@@ 735-744 (lines=10) @@
732
     *
733
     * @throws InvalidArgumentException
734
     */
735
    public static function ipv6($value, $message = '')
736
    {
737
        static::string($value, $message);
738
        if (false === \filter_var($value, \FILTER_VALIDATE_IP, \FILTER_FLAG_IPV6)) {
739
            static::reportInvalidArgument(\sprintf(
740
                $message ?: 'Expected a value to be an IPv6. Got %s',
741
                static::valueToString($value)
742
            ));
743
        }
744
    }
745
746
    /**
747
     * @psalm-assert string $value
@@ 754-763 (lines=10) @@
751
     *
752
     * @throws InvalidArgumentException
753
     */
754
    public static function email($value, $message = '')
755
    {
756
        static::string($value, $message);
757
        if (false === \filter_var($value, FILTER_VALIDATE_EMAIL)) {
758
            static::reportInvalidArgument(\sprintf(
759
                $message ?: 'Expected a value to be a valid e-mail address. Got %s',
760
                static::valueToString($value)
761
            ));
762
        }
763
    }
764
765
    /**
766
     * Does non strict comparisons on the items, so ['3', 3] will not pass the assertion.