You are here

public function ContainerBuilder::getExtension in Service Container 7

Same name and namespace in other branches
  1. 7.2 modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/ContainerBuilder.php \Symfony\Component\DependencyInjection\ContainerBuilder::getExtension()

Returns an extension by alias or namespace.

@api

Parameters

string $name An alias or a namespace:

Return value

ExtensionInterface An extension instance

Throws

LogicException if the extension is not registered

File

modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/ContainerBuilder.php, line 153

Class

ContainerBuilder
ContainerBuilder is a DI container that provides an API to easily describe services.

Namespace

Symfony\Component\DependencyInjection

Code

public function getExtension($name) {
  if (isset($this->extensions[$name])) {
    return $this->extensions[$name];
  }
  if (isset($this->extensionsByNs[$name])) {
    return $this->extensionsByNs[$name];
  }
  throw new LogicException(sprintf('Container extension "%s" is not registered', $name));
}