Code Duplication    Length = 9-9 lines in 4 locations

src/Assert.php 4 locations

@@ 667-675 (lines=9) @@
664
     *
665
     * @throws InvalidArgumentException
666
     */
667
    public static function ip($value, $message = '')
668
    {
669
        if (false === \filter_var($value, \FILTER_VALIDATE_IP)) {
670
            static::reportInvalidArgument(\sprintf(
671
                $message ?: 'Expected a value to be an IP. Got: %s',
672
                static::valueToString($value)
673
            ));
674
        }
675
    }
676
677
    /**
678
     * @param mixed  $value
@@ 683-691 (lines=9) @@
680
     *
681
     * @throws InvalidArgumentException
682
     */
683
    public static function ipv4($value, $message = '')
684
    {
685
        if (false === \filter_var($value, \FILTER_VALIDATE_IP, \FILTER_FLAG_IPV4)) {
686
            static::reportInvalidArgument(\sprintf(
687
                $message ?: 'Expected a value to be an IPv4. Got: %s',
688
                static::valueToString($value)
689
            ));
690
        }
691
    }
692
693
    /**
694
     * @param mixed  $value
@@ 699-707 (lines=9) @@
696
     *
697
     * @throws InvalidArgumentException
698
     */
699
    public static function ipv6($value, $message = '')
700
    {
701
        if (false === \filter_var($value, \FILTER_VALIDATE_IP, \FILTER_FLAG_IPV6)) {
702
            static::reportInvalidArgument(\sprintf(
703
                $message ?: 'Expected a value to be an IPv6. Got: %s',
704
                static::valueToString($value)
705
            ));
706
        }
707
    }
708
709
    /**
710
     * @param mixed  $value
@@ 715-723 (lines=9) @@
712
     *
713
     * @throws InvalidArgumentException
714
     */
715
    public static function email($value, $message = '')
716
    {
717
        if (false === \filter_var($value, FILTER_VALIDATE_EMAIL)) {
718
            static::reportInvalidArgument(\sprintf(
719
                $message ?: 'Expected a value to be a valid e-mail address. Got: %s',
720
                static::valueToString($value)
721
            ));
722
        }
723
    }
724
725
    /**
726
     * Does non strict comparisons on the items, so ['3', 3] will not pass the assertion.