// Is the variable found?
/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('BASE-TEMPLATE: found[]=%s', gettype($found)));
- if ($found !== false) {
+ if ($found > -1) {
// Read it
/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-TEMPLATE: Invoking this->getVariableValue(%s,%s) ...', $variableGroup, $found));
$value = $this->getVariableValue($variableGroup, $found);
// Get index for variable
/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-TEMPLATE: this->getVariableIndex(%s) ...', $variableName));
$index = $this->getVariableIndex($variableName);
+ assert($index >= 0, sprintf('variableName=%s not found', $variableName));
// Then modify it
/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-TEMPLATE: this->setVariableValue(%s,%d,value[]=%s) ...', $this->currGroup, $index, gettype($value)));
$index = $this->getVariableIndex($variableName);
// Is the variable set?
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('BASE-TEMPLATE: index[]=%s', gettype($index)));
- if ($index === false) {
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('BASE-TEMPLATE: index[%s]=%d', gettype($index), $index));
+ if ($index === -1) {
// Is the stack there?
if (!isset($this->varStack[$variableGroup])) {
// Then initialize it here
if ((!isset($this->loadedRawData[$template])) && (!in_array($template, $this->loadedTemplates))) {
// Template not found, but maybe variable assigned?
/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('BASE-TEMPLATE: template=%s not loaded yet', $template));
- if ($this->getVariableIndex($template) !== false) {
+ if ($this->getVariableIndex($template) > -1) {
// Use that content here
/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('BASE-TEMPLATE: Assigning this->loadedTemplateData[%s] from variable template=%s ...', $template, $template));
$this->loadedRawData[$template] = $this->readVariable($template);
$index = $this->getVariableIndex($variableName);
// Was it found?
- if ($index === false) {
+ if ($index === -1) {
// Add it to the stack
//* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-TEMPLATE:ADD: ' . $variableName . '[' . gettype($value) . ']=' . $value);
$this->addVariable($variableName, $value);
$index = $this->getVariableIndex($variableName, $variableGroup);
// Was it found?
- if ($index !== false) {
+ if ($index > -1) {
// Remove this variable
//* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-TEMPLATE:UNSET: variableGroup=' . $variableGroup . ',variableName=' . $variableName . ',index=' . $index);
$this->unsetVariableStackOffset($index, $variableGroup);