• Модуль: im
  • Путь к файлу: ~/bitrix/modules/im/lib/V2/Rest/RestAdapter.php
  • Класс: BitrixImV2RestRestAdapter
  • Вызов: RestAdapter::toRestFormat
public function toRestFormat(array $options = []): array
{
	$popupData = new PopupData([]);

	foreach ($this->entities as $entity)
	{
		if ($entity instanceof PopupDataAggregatable)
		{
			$popupData->merge($entity->getPopupData($options['POPUP_DATA_EXCLUDE'] ?? []));
		}
	}

	if (isset($this->additionalPopupData))
	{
		$popupData->merge($this->additionalPopupData);
	}

	$rest = $popupData->toRestFormat();

	if (empty($rest))
	{
		if (count($this->entities) === 1)
		{
			return $this->entities[0]->toRestFormat($options);
		}
	}

	foreach ($this->entities as $entity)
	{
		$rest[$entity::getRestEntityName()] = $entity->toRestFormat($options);
	}

	return $rest;
}