Code Duplication    Length = 11-13 lines in 2 locations

src/Assert.php 2 locations

@@ 942-952 (lines=11) @@
939
     *
940
     * @throws InvalidArgumentException
941
     */
942
    public static function range($value, $min, $max, $message = '')
943
    {
944
        if ($value < $min || $value > $max) {
945
            static::reportInvalidArgument(\sprintf(
946
                $message ?: 'Expected a value between %2$s and %3$s. Got: %s',
947
                static::valueToString($value),
948
                static::valueToString($min),
949
                static::valueToString($max)
950
            ));
951
        }
952
    }
953
954
    /**
955
     * Does strict comparison, so Assert::oneOf(3, ['3']) does not pass the assertion.
@@ 1318-1330 (lines=13) @@
1315
     *
1316
     * @throws InvalidArgumentException
1317
     */
1318
    public static function lengthBetween($value, $min, $max, $message = '')
1319
    {
1320
        $length = static::strlen($value);
1321
1322
        if ($length < $min || $length > $max) {
1323
            static::reportInvalidArgument(\sprintf(
1324
                $message ?: 'Expected a value to contain between %2$s and %3$s characters. Got: %s',
1325
                static::valueToString($value),
1326
                $min,
1327
                $max
1328
            ));
1329
        }
1330
    }
1331
1332
    /**
1333
     * Will also pass if $value is a directory, use Assert::file() instead if you need to be sure it is a file.