@param string $value
@param int    $maxSize

@return Generator
513613
protected function chunkString(string $value, int $maxSize): Generator
    {
        $isValidInput = $maxSize > 0;

        assert($isValidInput === true);

        if ($isValidInput === true) {
            $start  = 0;
            $length = strlen($value);
            if ($length === 0) {
                yield $value;
            }
            while ($start < $length) {
                yield substr($value, $start, $maxSize);
                $start += $maxSize;
            }
        }
    }
54759
public static function length(string $value, int $min, int $max):bool
    {
        $value = (string)$value;
        $length = Str::length($value);
        return $length >= $min && $length <= $max;
    }
778427
public function setAllowMaxSize($value) {
        $value = intval($value);
        if ($value > 0) {
            $this->allowMaxSize = $value;
        } else {
            throw new \BadMethodCallException('given $value must be integer, greater them 0');
        }
        return $this;
    }
1324958
public static function in_range($value, $min=null, $max=null) {
		return sanitize::to_range($value, $min, $max) === $value;
	}
1341303
public function limitSize($max) {
		// if the maximum is not numeric
		if(is_numeric($max)) {
			// set maximum
			$this->Limits->Size = intval($max);
		}
		// return self
		return($this);
	}
905483
public function setMax($value)
    {
        $this->max = $value === null ? null : (int) $value;

        return $this;
    }
688249
public function decode(string $input, int $maxSize) { /* : ?array */
        $headers = [];
        $off = 0;
        $inputLength = \strlen($input);
        $size = 0;

        // dynamic $table as per 2.3.2
        while ($off < $inputLength) {
            $index = \ord($input[$off++]);

            if ($index & 0x80) {
                // range check
                if ($index <= self::LAST_INDEX + 0x80) {
                    if ($index === 0x80) {
                        return null;
                    }

                    list($name, $value) = $headers[] = self::TABLE[$index - 0x81];
                } else {
                    if ($index == 0xff) {
                        $index = self::decodeDynamicInteger($input, $off) + 0xff;
                    }

                    $index -= 0x81 + self::LAST_INDEX;
                    if (!isset($this->headers[$index])) {
                        return null;
                    }

                    list($name, $value) = $headers[] = $this->headers[$index];
                }
            } elseif (($index & 0x60) !== 0x20) { // (($index & 0x40) || !($index & 0x20)): bit 4: never index is ignored
                $dynamic = (bool) ($index & 0x40);

                if ($index & ($dynamic ? 0x3f : 0x0f)) { // separate length
                    if ($dynamic) {
                        if ($index === 0x7f) {
                            $index = self::decodeDynamicInteger($input, $off) + 0x3f;
                        } else {
                            $index &= 0x3f;
                        }
                    } else {
                        $index &= 0x0f;
                        if ($index === 0x0f) {
                            $index = self::decodeDynamicInteger($input, $off) + 0x0f;
                        }
                    }

                    if ($index <= self::LAST_INDEX) {
                        $header = self::TABLE[$index - 1];
                    } else {
                        $header = $this->headers[$index - 1 - self::LAST_INDEX];
                    }
                } else {
                    $len = \ord($input[$off++]);
                    $huffman = $len & 0x80;
                    $len &= 0x7f;

                    if ($len === 0x7f) {
                        $len = self::decodeDynamicInteger($input, $off) + 0x7f;
                    }

                    if ($inputLength - $off < $len || $len <= 0) {
                        return null;
                    }

                    if ($huffman) {
                        $header = [self::huffmanDecode(\substr($input, $off, $len))];
                    } else {
                        $header = [\substr($input, $off, $len)];
                    }

                    $off += $len;
                }

                if ($off === $inputLength) {
                    return null;
                }

                $len = \ord($input[$off++]);
                $huffman = $len & 0x80;
                $len &= 0x7f;

                if ($len === 0x7f) {
                    $len = self::decodeDynamicInteger($input, $off) + 0x7f;
                }

                if ($inputLength - $off < $len || $len < 0) {
                    return null;
                }

                if ($huffman) {
                    $header[1] = self::huffmanDecode(\substr($input, $off, $len));
                } else {
                    $header[1] = \substr($input, $off, $len);
                }

                $off += $len;

                if ($dynamic) {
                    \array_unshift($this->headers, $header);
                    $this->size += 32 + \strlen($header[0]) + \strlen($header[1]);
                    if ($this->maxSize < $this->size) {
                        $this->resizeTable();
                    }
                }

                list($name, $value) = $headers[] = $header;
            } else { // if ($index & 0x20) {
                if ($index === 0x3f) {
                    $index = self::decodeDynamicInteger($input, $off) + 0x40;
                }

                if ($index > 4096) { // initial limit … may be adjusted??
                    return null;
                }

                $name = $value = '';
                $this->resizeTable($index);
            }

            $size += \strlen($name) + \strlen($value);

            if ($size > $maxSize) {
                return null;
            }
        }

        return $headers;
    }
302830
public static function isRequiredNumericRange($value, $min, $max)
    {
        return is_numeric($value) && $min <= $value && $max >= $value;
    }
155269
public function sizeMax($sizeMax, $error) {
        if ($this->_exist) {
            array_push($this->_constraints, ['type' => self::SIZEMIN, 'value' => $sizeMax, 'message' => $error]);
        }

        return $this;
    }
446700
public function listUsers(int $maxResults = null, int $batchSize = null): \Generator
    {
        $maxResults = $maxResults ?? 1000;
        $batchSize = $batchSize ?? 1000;

        $pageToken = null;
        $count = 0;

        do {
            $response = $this->client->downloadAccount($batchSize, $pageToken);
            $result = JSON::decode((string) $response->getBody(), true);

            foreach ((array) ($result['users'] ?? []) as $userData) {
                yield UserRecord::fromResponseData($userData);

                if (++$count === $maxResults) {
                    return;
                }
            }

            $pageToken = $result['nextPageToken'] ?? null;
        } while ($pageToken);
    }
960950
protected function keep_within($value, $min, $max) {
        if ($value < $min) {
            return $min;
        }
        if ($value > $max) {
            return $max;
        }
        return $value;
    }
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;
    }
422053
protected static function check($value, $min, $max)
    {
        $length = strlen($value);

        if ($length < $min)
            return self::STATUS_WARNING;

        if ($min <= $length && $length <= $max)
            return self::STATUS_GOOD;

        return self::STATUS_DANGER;
    }
126153
protected function withSize(int $maxSize): AbstractPool
	{
		if ($maxSize <= 0) {
			throw new \InvalidArgumentException(PoolException::ERROR_INVALID_POOL_SIZE);
		}
		$this->maxSize = $maxSize;
		
		return $this;
	}
1250842
public function setSharedMaxAge(int $value)
    {
        $this->setPublic();
        $this->headers->addCacheControlDirective('s-maxage', $value);

        return $this;
    }
749967
public static function isOptionalNumberRange($value, $min, $max)
    {
        /* No additional validations when the value is null. */
        if (null === $value) {

            return true;
        }

        return self::isRequiredNumberRange($value, $min, $max);
    }
97588
public function split(int $max): iterable
    {
        $pos = 0;
        $total = count($this->values);
        while ($pos < $total) {
            $clone = clone $this;
            $clone->values = array_slice($this->values, $pos, $max);
            $pos += $max;
            yield $clone;
        }
    }