/** * Configure twig environment. * * @param \Twig_Environment $environment * @return \Twig_Environment */ protected function configure(\Twig_Environment $environment) { $environment->setBaseTemplateClass(TwigView::class); /** * Registering extensions. */ foreach ($this->extensions as $extension) { $environment->addExtension($this->container->get($extension)); } return $environment; }