• Модуль: catalog
  • Путь к файлу: ~/bitrix/modules/catalog/lib/v2/IoC/Container.php
  • Класс: BitrixCatalogv2IoCContainer
  • Вызов: Container::inject
public function inject(string $id, $dependency): ContainerContract
{
	if ($this->isLocked())
	{
		throw new NotSupportedException(
			"Dependency {{$dependency}} cannot be injected after resolving container dependencies.
			 Try this before resolving."
		);
	}

	$this->dependencies[$id] = $dependency;

	if (!isset($this->dependencies[$dependency]) && class_exists($dependency))
	{
		$this->dependencies[$dependency] = $dependency;
	}

	unset($this->entities[$id]);

	return $this;
}