public function __construct() { //@todo: this is hardcode. we should move it to some templating component $loader = new TemplateLoader(); $this->twig = new \Twig_Environment($loader); $this->twig->enableStrictVariables(); }
/** * Enable or not strict variables. * * @param boolean $strict */ public function setStrictVariables($strict) { if ((bool) $strict) { $this->templating->enableStrictVariables(); } else { $this->templating->disableStrictVariables(); } }
/** * Creates a Twig rendering engine * @param type $viewRootFolder * @param type $cacheFolder * @param type $debug * @return \Twig_Environment */ protected function createTwig($viewRootFolder, $cacheFolder, $debug) { $this->loader = new \Twig_Loader_Filesystem($viewRootFolder); $twig = new \Twig_Environment($this->loader); $twig->enableStrictVariables(); if ($debug === true) { $twig->enableDebug(); } else { $twig->disableDebug(); $twig->setCache($cacheFolder); } return $twig; }