• Модуль: main
  • Путь к файлу: ~/bitrix/modules/main/lib/engine/router.php
  • Класс: BitrixMainEngineRouter
  • Вызов: Router::getComponentControllerAndAction
private function getComponentControllerAndAction()
{
	$componentAsString = var_export($this->component, true);
	if ($this->mode === self::COMPONENT_MODE_CLASS)
	{
		$component = $this->buildComponent($this->component, $this->request->getPost('signedParameters'));
		if (!$component)
		{
			throw new SystemException(
				"Could not build component instance {$componentAsString}",
				self::EXCEPTION_INVALID_COMPONENT
			);
		}

		return array(new ComponentController($component), $this->action);
	}
	elseif ($this->mode === self::COMPONENT_MODE_AJAX)
	{
		$ajaxClass = $this->includeComponentAjaxClass($this->component);

		$controller = ControllerBuilder::build($ajaxClass, [
			'scope' => Controller::SCOPE_AJAX,
			'currentUser' => CurrentUser::get(),
		]);

		return [$controller, $this->action];
	}
	else
	{
		$modeAsString = var_export($this->mode, true);
		throw new SystemException(
			"Unknown ajax mode ({$modeAsString}) to work {$componentAsString}",
			self::EXCEPTION_INVALID_AJAX_MODE
		);
	}
}