• Модуль: im
  • Путь к файлу: ~/bitrix/modules/im/lib/V2/Message/CounterService.php
  • Класс: BitrixImV2MessageCounterService
  • Вызов: CounterService::get
public function get(): array
{
	$userId = $this->getContext()->getUserId();
	if (isset(self::$staticCounterCache[$userId]))
	{
		return self::$staticCounterCache[$userId];
	}

	$cache = $this->getCacheForPreparedCounters();
	$cachedCounters = $cache->getVars();
	if ($cachedCounters !== false)
	{
		self::$staticCounterCache[$userId] = $cachedCounters;

		return $cachedCounters;
	}

	$this->counters = static::DEFAULT_COUNTERS;
	$this->countersByChatIds = [];

	$this->countUnreadMessages();
	$this->countUnreadChats();

	$this->savePreparedCountersInCache($cache);
	$this->saveChatsCountersInCache($this->getCacheForChatsCounters());

	return $this->counters;
}