Esempio n. 1
0
 private function fillVariables($variables, $overwrite = false)
 {
     foreach ($variables as $key => $val) {
         $this->variablesId++;
         $variable = new Variable();
         $variable->setId($this->variablesId);
         $variable->setName($key);
         $variable->setValue($val);
         $tmpName = $variable->getTemplateName();
         $ifName = $variable->getIfName();
         $ifNotName = $variable->getIfNotName();
         #fwrite(STDOUT, "settings: '".$key."' '".$tmpName."' '".$ifName."' => '".$val."'\n");
         if ($overwrite || !$overwrite && !isset($this->variables[$tmpName])) {
             $this->variables[$tmpName] = $variable;
             $variableIf = clone $variable;
             if ($tmpName != $ifName) {
                 #$variableIf->setReference($variable);
                 $this->variablesId++;
                 $variableIf->setId($this->variablesId);
                 $variableIf->setValue((bool) $val);
                 $this->variables[$ifName] = $variableIf;
             }
             $variableIfNot = clone $variableIf;
             #$variableIfNot->setReference($variableIf);
             $this->variablesId++;
             $variableIfNot->setId($this->variablesId);
             $variableIfNot->setValue(!$variableIfNot->getValue());
             $this->variables[$ifNotName] = $variableIfNot;
         }
     }
 }
Esempio n. 2
0
 public function testGetTemplateName()
 {
     $variable = new Variable();
     $this->assertEquals('', $variable->getTemplateName());
 }