• Модуль: main
  • Путь к файлу: ~/bitrix/modules/main/lib/web/cookiescrypter.php
  • Класс: BitrixMainWebCookiesCrypter
  • Вызов: CookiesCrypter::packCookie
protected function packCookie(CryptoCookie $cookie, string $encryptedValue): iterable
{
	$length = strlen($encryptedValue);
	$maxContentLength = static::COOKIE_MAX_SIZE - static::COOKIE_RESERVED_SUFFIX_BYTES - strlen($cookie->getName());

	$i = 0;
	$parts = ($length / $maxContentLength);
	$pack = [];
	do
	{
		$startPosition = $i * $maxContentLength;
		$partCookie = new Cookie("{$cookie->getName()}_{$i}", substr($encryptedValue, $startPosition, $maxContentLength));
		$cookie->copyAttributesTo($partCookie);
		$pack["{$cookie->getOriginalName()}_{$i}"] = $partCookie;

		$i++;
	}
	while($parts > $i);

	$mainCookie = new Cookie($cookie->getName(), $this->prependSign(implode(',', array_keys($pack))));
	$cookie->copyAttributesTo($mainCookie);

	array_unshift($pack, $mainCookie);

	return $pack;
}