Esempio n. 1
0
 /**
  * Add a new namespace to the loader.
  *
  * @param  \TwigBridge\StringView\StringView  $view
  * @return \TwigBridge\Twig\Template
  */
 public function resolveTemplate(StringView $view)
 {
     $currentLoader = $this->twig->getLoader();
     $loader = new Loader($view);
     $this->twig->setLoader($loader);
     $template = $this->twig->resolveTemplate($view->getName());
     $this->twig->setLoader($currentLoader);
     return $template;
 }
Esempio n. 2
0
 /**
  * Constructor.
  *
  * @param array $templates An array of templates (keys are the names, and values are the source code)
  */
 public function __construct(StringView $view)
 {
     $this->templates[$view->getName()] = $view;
 }