enableStrictVariables() public method

Enables the strict_variables option.
コード例 #1
0
 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();
 }
コード例 #2
0
 /**
  * Enable or not strict variables.
  *
  * @param boolean $strict
  */
 public function setStrictVariables($strict)
 {
     if ((bool) $strict) {
         $this->templating->enableStrictVariables();
     } else {
         $this->templating->disableStrictVariables();
     }
 }
コード例 #3
0
ファイル: TwigEngine.php プロジェクト: blendsdk/blendengine
 /**
  * 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;
 }