Code Duplication    Length = 11-13 lines in 2 locations

src/Assert.php 2 locations

@@ 1006-1016 (lines=11) @@
1003
     *
1004
     * @throws InvalidArgumentException
1005
     */
1006
    public static function range($value, $min, $max, $message = '')
1007
    {
1008
        if ($value < $min || $value > $max) {
1009
            static::reportInvalidArgument(\sprintf(
1010
                $message ?: 'Expected a value between %2$s and %3$s. Got: %s',
1011
                static::valueToString($value),
1012
                static::valueToString($min),
1013
                static::valueToString($max)
1014
            ));
1015
        }
1016
    }
1017
1018
    /**
1019
     * Does strict comparison, so Assert::oneOf(3, ['3']) does not pass the assertion.
@@ 1382-1394 (lines=13) @@
1379
     *
1380
     * @throws InvalidArgumentException
1381
     */
1382
    public static function lengthBetween($value, $min, $max, $message = '')
1383
    {
1384
        $length = static::strlen($value);
1385
1386
        if ($length < $min || $length > $max) {
1387
            static::reportInvalidArgument(\sprintf(
1388
                $message ?: 'Expected a value to contain between %2$s and %3$s characters. Got: %s',
1389
                static::valueToString($value),
1390
                $min,
1391
                $max
1392
            ));
1393
        }
1394
    }
1395
1396
    /**
1397
     * Will also pass if $value is a directory, use Assert::file() instead if you need to be sure it is a file.