Code Duplication    Length = 11-13 lines in 2 locations

src/Assert.php 2 locations

@@ 1092-1102 (lines=11) @@
1089
     *
1090
     * @throws InvalidArgumentException
1091
     */
1092
    public static function range($value, $min, $max, $message = '')
1093
    {
1094
        if ($value < $min || $value > $max) {
1095
            static::reportInvalidArgument(\sprintf(
1096
                $message ?: 'Expected a value between %2$s and %3$s. Got: %s',
1097
                static::valueToString($value),
1098
                static::valueToString($min),
1099
                static::valueToString($max)
1100
            ));
1101
        }
1102
    }
1103
1104
    /**
1105
     * Does strict comparison, so Assert::oneOf(3, ['3']) does not pass the assertion.
@@ 1548-1560 (lines=13) @@
1545
     *
1546
     * @throws InvalidArgumentException
1547
     */
1548
    public static function lengthBetween($value, $min, $max, $message = '')
1549
    {
1550
        $length = static::strlen($value);
1551
1552
        if ($length < $min || $length > $max) {
1553
            static::reportInvalidArgument(\sprintf(
1554
                $message ?: 'Expected a value to contain between %2$s and %3$s characters. Got: %s',
1555
                static::valueToString($value),
1556
                $min,
1557
                $max
1558
            ));
1559
        }
1560
    }
1561
1562
    /**
1563
     * Will also pass if $value is a directory, use Assert::file() instead if you need to be sure it is a file.