You are here

public function ContainerBuilder::getExtension in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/symfony/dependency-injection/ContainerBuilder.php \Symfony\Component\DependencyInjection\ContainerBuilder::getExtension()

Returns an extension by alias or namespace.

Parameters

string $name An alias or a namespace:

Return value

ExtensionInterface An extension instance

Throws

LogicException if the extension is not registered

File

vendor/symfony/dependency-injection/ContainerBuilder.php, line 147

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