bundles/BlockManagerBundle/EventListener/TwigExtensionsListener.php
public function onKernelRequest(GetResponseEvent $event): void
    {
        foreach ($this->extensions as $extension) {
            if (!class_exists($extension) || !is_a($extension, ExtensionInterface::class, true)) {
                continue;
            }

            if ($this->twig->hasExtension($extension)) {
                continue;
            }

            $this->twig->addExtension(new $extension());
        }
    }
public function onKernelRequest(GetResponseEvent $event): void
    {
        foreach ($this->extensions as $extension) {
            if (!class_exists($extension) || !is_a($extension, ExtensionInterface::class, true)) {
                continue;
            }

            if ($this->twig->hasExtension($extension)) {
                continue;
            }

            $this->twig->addExtension(new $extension());
        }
    }
public function onKernelRequest ( GetResponseEvent $ event ) : void { foreach ( $ this -> extensions as $ extension ) { if ( ! class_exists ( $ extension ) || ! is_a ( $ extension , ExtensionInterface :: class , true ) ) { continue ; } if ( $ this -> twig -> hasExtension ( $ extension ) ) { continue ; } $ this -> twig -> addExtension ( new $ extension ( ) ) ; } }
Adds the Twig extensions to the environment if they don't already exist.
Adds the Twig extensions to the environment if they don t already exist .