Validate string from COOKIE - $_COOKIE["key"].

@param string $key
@param integer $minLength
@param mixed $maxLength Integer or false when there is no limit
@param mixed $default - default value will be returned when validation fails

@return mixed
425034
public function strCookie($key, $minLength = 0, $maxLength = false, $default = false)
	{
		return $this->str($this->cookie($key), $minLength, $maxLength, $default);
	}
516235
protected static function stringLengthBetween(int $min, int $max, RuleInterface $next = null): RuleInterface
    {
        return $next === null ?
            new StringLengthBetween($min, $max) :
            new AndOperator(static::stringLengthBetween($min, $max), $next);
    }
518447
protected function sizeMax($key, $lengthValue, $max, $not = true)
    {
        if (($lengthValue > $max) && $not) {
            $this->addReturn($key, 'must', [ ':max' => $max ]);
        } elseif (!($lengthValue > $max) && !$not) {
            $this->addReturn($key, 'not', [ ':max' => $max ]);
        }
    }
86581
public function plainSession($key, $minLength = 0, $maxLength = false, $default = false)
	{
		return $this->plain($this->session($key), $minLength, $maxLength, $default);
	}
1068504
static public function betweenLength($value, $minLength, $maxLength, $message = null, $propertyPath = null, $encoding = 'utf8')
        {
            static::string($value, $message);

            if (mb_strlen($value, $encoding) < $minLength) {
                $message = $message ?: sprintf(
                    'Value "%s" is too short, it should have more than %d characters, but only has %d characters.',
                    static::stringify($value),
                    $minLength,
                    mb_strlen($value, $encoding)
                );

                $constraints = array('min_length' => $minLength, 'encoding' => $encoding);

                throw static::createException($value, $message, static::INVALID_MIN_LENGTH, $propertyPath, $constraints);
            }

            if (mb_strlen($value, $encoding) > $maxLength) {
                $message = $message ?: sprintf(
                    'Value "%s" is too long, it should have no more than %d characters, but has %d characters.',
                    static::stringify($value),
                    $maxLength,
                    mb_strlen($value, $encoding)
                );

                $constraints = array('max_length' => $maxLength, 'encoding' => $encoding);

                throw static::createException($value, $message, static::INVALID_MAX_LENGTH, $propertyPath, $constraints);
            }
        }
1354874
protected function replaceFieldMaxLengthName(&$stub, $maxLength)
    {
        $stub = $this->strReplace('max_length', $this->getFieldMaxLengthName($maxLength), $stub);

        return $this;
    }
81519
public function validateLength($min_length, $max_length)
    {
        $this->validator_attributes[] = 'data-parsley-length="[' . (int)$min_length . ', ' . (int)$max_length . ']"';

        $this->validator_checks['min_length'] = (int)$min_length;
        $this->validator_checks['max_length'] = (int)$max_length;

        return $this;
    }
1334510
public function rule_between_num( $key, $value, $min, $max )
	{
		if ( !$this->rule_min_num( $key, $value, $min ) )
		{
			return false;
		}
		if ( !$this->rule_max_num( $key, $value, $max ) )
		{
			return false;
		}
		return true;
	}
1064054
public function length($min, $max = null) {
        if (!$this->_isValid) {
            return $this;
        }
        $length = mb_strlen($this->_unsafeVar, $this->conf['encoding']);
        if ($length < $min || (!is_null($max) && $length > $max)) {
            $this->_isValid = false;
        }
        return $this;
    }
230100
public function eatSpan($mask, $maxLength = null)
    {
        if (null === $maxLength) {
            $maxLength = $this->getRemainingByteCount();
        }

        return $this->read(strspn($this->data, $mask, $this->offset, $maxLength));
    }
496170
public function orNotBetween($key, $min, $max)
    {
        $value = sprintf('%s NOT BETWEEN ? AND ?', $key);
        return $this->orAdd($value, [$min, $max]);
    }
1189120
public static function lengthChar($val, $min, $max = null)
    {
        $len = mb_strlen($val, 'utf8');
        $result = ($len >= $min);
        if($max !== null)
        {
            $result = ($result && $len <= $max);
        }
        return $result;
    }
41810
public function rule_between( $key, $value, $min, $max )
	{
		return $this->rule_between_num( $key, strlen( $value ), $min, $max );
	}
591898
public function setMinLength($minLength)
    {
        if (!is_integer($minLength)) {
            throw new InvalidArgumentException(
                'Min length must be an integer.'
            );
        }

        if ($minLength < 0) {
            throw new InvalidArgumentException(
                'Min length must be a positive integer (>=0).'
            );
        }

        $this->minLength = $minLength;

        return $this;
    }
1001440
public static function length($value, $min = null, $max = null)
    {
        $length = mb_strlen($value);

        if (is_numeric($min) && $min > 0 && $length < $min) {
            return false;
        }

        if (is_numeric($max) && $max > 0 && $length > $max) {
            return false;
        }

        return true;
    }
52721
public function cookie($key = null, $default = null)
    {
        $cookies = $this->getCookieParams();

        return is_null($key) ? $cookies : data_get($cookies, $key, $default);
    }
1050849
public static function rangeLength($value, int $minLength, int $maxLength, string $encoding = 'UTF-8'): bool
    {
        if (!static::isStringCastable($value)) {
            return false;
        }

        $strlen = (int) mb_strlen((string) $value, $encoding);

        if ($strlen < $minLength) {
            return false;
        }
        if ($strlen > $maxLength) {
            return false;
        }

        return true;
    }