• Модуль: main
  • Путь к файлу: ~/bitrix/modules/main/lib/engine/resolver.php
  • Класс: BitrixMainEngineResolver
  • Вызов: Resolver::buildControllerClassName
static function buildControllerClassName($vendor, $module, array $actionParts)
{
	$controllerName = array_pop($actionParts);

	if (self::isOldFullQualifiedName($vendor, $module, $actionParts))
	{
		$actionParts[] = $controllerName;
		$className = implode('\', $actionParts);
		if (!self::checkClassUnderAllowedNamespaces($module, $className))
		{
			return null;
		}

		return $className;
	}

	$namespaces = self::listAllowedNamespaces($module);

	$aliases = array_change_key_case($namespaces, CASE_LOWER);
	$probablyPrefix = mb_strtolower(reset($actionParts));
	if (isset($aliases[$probablyPrefix]))
	{
		$alias = $aliases[$probablyPrefix];
		array_shift($actionParts); //drop prefix
		array_push($actionParts, $controllerName);

		return $alias . '\' . implode('\', $actionParts);
	}

	$furtherControllerClassName = self::buildClassNameByAction(
		$vendor,
		$module,
		array_merge($actionParts, [$controllerName])
	);
	if (self::checkClassUnderAllowedNamespaces($module, $furtherControllerClassName))
	{
		return $furtherControllerClassName;
	}

	$defaultNamespaceByModule = self::getDefaultNamespaceByModule($module);
	if (!$defaultNamespaceByModule)
	{
		return null;
	}

	$defaultPath = strtr($defaultNamespaceByModule, ['\' => '.']);

	// do not lower if probably psr4
	$firstLetter = mb_substr($controllerName, 0, 1);

	if ($firstLetter === mb_strtolower($firstLetter))
	{
		$defaultPath = mb_strtolower($defaultPath);
	}


	array_unshift($actionParts, ...explode('.', $defaultPath));
	array_push($actionParts, $controllerName);

	return implode('\', $actionParts);
}