+
+ // Then modify it
+ $this->setVariableValue($this->currGroup, $index, $value);
+ }
+
+ /**
+ * Sets a variable value for given variable group and index
+ *
+ * @param $varGroup Variable group to use
+ * @param $index Index in variable array
+ * @param $value Value to set
+ * @return void
+ */
+ private function setVariableValue ($varGroup, $index, $value) {
+ $this->varStack[$varGroup][$index]['value'] = $value;
+ }
+
+ /**
+ * Sets a variable within given group. This method does detect if the
+ * variable is already set. If so, the variable got modified, otherwise
+ * added.
+ *
+ * @param $varGroup Variable group to use
+ * @param $var Variable to set
+ * @param $value Value to set
+ * @return void
+ */
+ protected function setVariable ($varGroup, $var, $value) {
+ // Get index for variable
+ $index = $this->getVariableIndex($var);
+
+ // Is the variable set?
+ if ($index === false) {
+ // Not found, add it
+ $this->varStack[$varGroup][] = $this->generateVariableArray($var, $value);
+ } else {
+ // Then modify it
+ $this->setVariableValue($this->currGroup, $index, $value);
+ }
+ }
+
+ /**
+ * "Generates" (better returns) an array for all variables for given
+ * variable/value pay.
+ *
+ * @param $var Variable to set
+ * @param $value Value to set
+ * @return $varData Variable data array
+ */
+ private function generateVariableArray ($var, $value) {
+ // Generate the temporary array
+ $varData = array(
+ 'name' => $var,
+ 'value' => $value
+ );
+
+ // And return it
+ return $varData;