• Модуль: main
  • Путь к файлу: ~/bitrix/modules/main/lib/servicemanager.php
  • Класс: BitrixMainServiceManager
  • Вызов: ServiceManager::get
public function get($name)
{
	if (isset($this->tools[$name]) && count($this->tools[$name]) > 0)
	{
		$obj = $this->tools[$name][0];
		if (is_object($obj))
		{
			return $obj;
		}
		elseif (is_string($obj) && class_exists($obj))
		{
			$this->tools[$name][0] = new $obj();
			return $this->tools[$name][0];
		}
		elseif (is_array($obj) && isset($obj[0]) && isset($obj[1]) && is_string($obj[0]) && is_string($obj[1]))
		{
			if (Loader::includeModule($obj[0]) && class_exists($obj[1]))
			{
				$this->tools[$name][0] = new $obj[1]();
				return $this->tools[$name][0];
			}
			throw new LoaderException(sprintf("Class name '%s' is not found in module '%s'", htmlspecialchars($obj[1]), htmlspecialchars($obj[0])));
		}

		throw new SystemException(sprintf("Tool '%s' is not found", htmlspecialchars($obj)));
	}
	return null;
}