You are here

public function Twig_Environment::getExtension in Translation template extractor 6.3

Same name and namespace in other branches
  1. 7.3 vendor/Twig/Environment.php \Twig_Environment::getExtension()

Gets an extension by name.

Parameters

string $name The extension name:

Return value

Twig_ExtensionInterface A Twig_ExtensionInterface instance

File

vendor/Twig/Environment.php, line 643

Class

Twig_Environment
Stores the Twig configuration.

Code

public function getExtension($name) {
  if (!isset($this->extensions[$name])) {
    throw new Twig_Error_Runtime(sprintf('The "%s" extension is not enabled.', $name));
  }
  return $this->extensions[$name];
}