• Модуль: im
  • Путь к файлу: ~/bitrix/modules/im/lib/V2/Chat.php
  • Класс: BitrixImV2Chat
  • Вызов: Chat::getInstance
static function getInstance(?int $chatId): self
{
	if (!isset($chatId))
	{
		return new ImV2ChatNullChat();
	}

	if (isset(self::$chatStaticCache[$chatId]))
	{
		return self::$chatStaticCache[$chatId];
	}

	$chat = ChatFactory::getInstance()->getChatById($chatId);

	if ($chat instanceof ImV2ChatNullChat)
	{
		return $chat;
	}

	self::$chatStaticCache[$chatId] = $chat;

	return self::$chatStaticCache[$chatId];
}