Code Duplication    Length = 11-13 lines in 2 locations

src/Assert.php 2 locations

@@ 855-865 (lines=11) @@
852
     * @param mixed max
853
     * @param string $message
854
     */
855
    public static function range($value, $min, $max, $message = '')
856
    {
857
        if ($value < $min || $value > $max) {
858
            static::reportInvalidArgument(\sprintf(
859
                $message ?: 'Expected a value between %2$s and %3$s. Got: %s',
860
                static::valueToString($value),
861
                static::valueToString($min),
862
                static::valueToString($max)
863
            ));
864
        }
865
    }
866
867
    /**
868
     * Does strict comparison, so Assert::oneOf(3, ['3']) does not pass the assertion.
@@ 1195-1207 (lines=13) @@
1192
     * @param mixed  $max
1193
     * @param string $message
1194
     */
1195
    public static function lengthBetween($value, $min, $max, $message = '')
1196
    {
1197
        $length = static::strlen($value);
1198
1199
        if ($length < $min || $length > $max) {
1200
            static::reportInvalidArgument(\sprintf(
1201
                $message ?: 'Expected a value to contain between %2$s and %3$s characters. Got: %s',
1202
                static::valueToString($value),
1203
                $min,
1204
                $max
1205
            ));
1206
        }
1207
    }
1208
1209
    /**
1210
     * Will also pass if $value is a directory, use Assert::file() instead if you need to be sure it is a file.