Code Duplication    Length = 11-13 lines in 2 locations

src/Assert.php 2 locations

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