public function 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

drupal/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ContainerBuilder.php, line 141

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));
}