• Модуль: im
  • Путь к файлу: ~/bitrix/modules/im/lib/V2/Entity/Command/Command.php
  • Класс: BitrixImV2EntityCommandCommand
  • Вызов: Command::toRestFormat
public function toRestFormat(array $option = []): array
{
	$this->lang = $option['langId'] ?? LANGUAGE_ID;
	$commandList = $this->getCommandList($this->getBotId());
	$commandList = $this->prepareData($commandList);
	$commandList = $this->mergeWithDefaultCommands($commandList);

	$result = [];
	foreach ($commandList as $command)
	{
		$result[] = [
			'id' => is_numeric($command['ID']) ? (int)$command['ID'] : $command['ID'],
			'botId' => (int)$command['BOT_ID'],
			'command' => '/'. $command['COMMAND'],
			'category' => $command['CATEGORY'],
			'common' => $command['COMMON'],
			'context' => $command['CONTEXT'],
			'title' => $command['TITLE'],
			'params' => $command['PARAMS'],
			'extranet' => $command['EXTRANET_SUPPORT'],
		];
	}

	return $result;
}