Code Duplication    Length = 11-13 lines in 2 locations

src/Assert.php 2 locations

@@ 934-944 (lines=11) @@
931
     *
932
     * @throws InvalidArgumentException
933
     */
934
    public static function range($value, $min, $max, $message = '')
935
    {
936
        if ($value < $min || $value > $max) {
937
            static::reportInvalidArgument(\sprintf(
938
                $message ?: 'Expected a value between %2$s and %3$s. Got: %s',
939
                static::valueToString($value),
940
                static::valueToString($min),
941
                static::valueToString($max)
942
            ));
943
        }
944
    }
945
946
    /**
947
     * Does strict comparison, so Assert::oneOf(3, ['3']) does not pass the assertion.
@@ 1310-1322 (lines=13) @@
1307
     *
1308
     * @throws InvalidArgumentException
1309
     */
1310
    public static function lengthBetween($value, $min, $max, $message = '')
1311
    {
1312
        $length = static::strlen($value);
1313
1314
        if ($length < $min || $length > $max) {
1315
            static::reportInvalidArgument(\sprintf(
1316
                $message ?: 'Expected a value to contain between %2$s and %3$s characters. Got: %s',
1317
                static::valueToString($value),
1318
                $min,
1319
                $max
1320
            ));
1321
        }
1322
    }
1323
1324
    /**
1325
     * Will also pass if $value is a directory, use Assert::file() instead if you need to be sure it is a file.