public function testSetName3() { $variable = new Variable(); $variable->setName('text:test3'); $this->assertEquals('text:test3', $variable->getName()); $this->assertEquals('Iftest3', $variable->getIfName()); $this->assertEquals('IfNottest3', $variable->getIfNotName()); }
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; } } }