Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. ExtensionSet.php

function ExtensionSet::addExtension

1 call to ExtensionSet::addExtension()
ExtensionSet::setExtensions in vendor/twig/twig/src/ExtensionSet.php

File

vendor/twig/twig/src/ExtensionSet.php, line 128

Class

ExtensionSet
@author Fabien Potencier <fabien@symfony.com>

Namespace

Twig

Code

public function addExtension(ExtensionInterface $extension) : void {
    $class = \get_class($extension);
    if ($this->initialized) {
        throw new \LogicException(\sprintf('Unable to register extension "%s" as extensions have already been initialized.', $class));
    }
    if (isset($this->extensions[$class])) {
        throw new \LogicException(\sprintf('Unable to register extension "%s" as it is already registered.', $class));
    }
    $this->extensions[$class] = $extension;
}
RSS feed
Powered by Drupal