From: Roland Haeder <roland@mxchange.org>
Date: Sun, 9 Feb 2014 00:36:44 +0000 (+0100)
Subject: Little resorting of public methods: all variable-related methods on one place.
X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=6ebfbe928b401fb20d18ca062e6b4b93d210f95f;p=core.git

Little resorting of public methods: all variable-related methods on one place.

Signed-off-by: Roland Häder <roland@mxchange.org>
---

diff --git a/inc/classes/main/template/class_BaseTemplateEngine.php b/inc/classes/main/template/class_BaseTemplateEngine.php
index e7592c00..a47ce653 100644
--- a/inc/classes/main/template/class_BaseTemplateEngine.php
+++ b/inc/classes/main/template/class_BaseTemplateEngine.php
@@ -588,58 +588,6 @@ class BaseTemplateEngine extends BaseFrameworkSystem {
 		return $this->templateType;
 	}
 
-	/**
-	 * Assign (add) a given variable with a value
-	 *
-	 * @param	$variableName	The variable we are looking for
-	 * @param	$value			The value we want to store in the variable
-	 * @return	void
-	 * @throws	EmptyVariableException	If the variable name is left empty
-	 */
-	public final function assignVariable ($variableName, $value) {
-		// Replace all dashes to underscores to match variables with configuration entries
-		$variableName = trim($this->convertDashesToUnderscores($variableName));
-
-		// Empty variable found?
-		if (empty($variableName)) {
-			// Throw an exception
-			throw new EmptyVariableException(array($this, 'variableName'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
-		} // END - if
-
-		// First search for the variable if it was already added
-		$index = $this->getVariableIndex($variableName);
-
-		// Was it found?
-		if ($index === FALSE) {
-			// Add it to the stack
-			//* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(__METHOD__ . ':ADD: ' . $variableName . '[' . gettype($value) . ']=' . $value);
-			$this->addVariable($variableName, $value);
-		} elseif (!empty($value)) {
-			// Modify the stack entry
-			//* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(__METHOD__ . ':MOD: ' . $variableName . '[' . gettype($value) . ']=' . $value);
-			$this->modifyVariable($variableName, $value);
-		}
-	}
-
-	/**
-	 * Removes a given variable
-	 *
-	 * @param	$variableName	The variable we are looking for
-	 * @param	$variableGroup	Name of variable group (default: 'general')
-	 * @return	void
-	 */
-	public final function removeVariable ($variableName, $variableGroup = 'general') {
-		// First search for the variable if it was already added
-		$index = $this->getVariableIndex($variableName, $variableGroup);
-
-		// Was it found?
-		if ($index !== FALSE) {
-			// Remove this variable
-			//* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(__METHOD__ . ':UNSET: variableGroup=' . $variableGroup . ',variableName=' . $variableName . ',index=' . $index);
-			$this->unsetVariableStackOffset($index, $variableGroup);
-		} // END - if
-	}
-
 	/**
 	 * Unsets the given offset in the variable group
 	 *
@@ -1161,6 +1109,76 @@ class BaseTemplateEngine extends BaseFrameworkSystem {
 		$this->loadTemplate($template);
 	}
 
+	/**
+	 * Assign (add) a given variable with a value
+	 *
+	 * @param	$variableName	The variable we are looking for
+	 * @param	$value			The value we want to store in the variable
+	 * @return	void
+	 * @throws	EmptyVariableException	If the variable name is left empty
+	 */
+	public final function assignVariable ($variableName, $value) {
+		// Replace all dashes to underscores to match variables with configuration entries
+		$variableName = trim($this->convertDashesToUnderscores($variableName));
+
+		// Empty variable found?
+		if (empty($variableName)) {
+			// Throw an exception
+			throw new EmptyVariableException(array($this, 'variableName'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
+		} // END - if
+
+		// First search for the variable if it was already added
+		$index = $this->getVariableIndex($variableName);
+
+		// Was it found?
+		if ($index === FALSE) {
+			// Add it to the stack
+			//* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(__METHOD__ . ':ADD: ' . $variableName . '[' . gettype($value) . ']=' . $value);
+			$this->addVariable($variableName, $value);
+		} elseif (!empty($value)) {
+			// Modify the stack entry
+			//* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(__METHOD__ . ':MOD: ' . $variableName . '[' . gettype($value) . ']=' . $value);
+			$this->modifyVariable($variableName, $value);
+		}
+	}
+
+	/**
+	 * Removes a given variable
+	 *
+	 * @param	$variableName	The variable we are looking for
+	 * @param	$variableGroup	Name of variable group (default: 'general')
+	 * @return	void
+	 */
+	public final function removeVariable ($variableName, $variableGroup = 'general') {
+		// First search for the variable if it was already added
+		$index = $this->getVariableIndex($variableName, $variableGroup);
+
+		// Was it found?
+		if ($index !== FALSE) {
+			// Remove this variable
+			//* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(__METHOD__ . ':UNSET: variableGroup=' . $variableGroup . ',variableName=' . $variableName . ',index=' . $index);
+			$this->unsetVariableStackOffset($index, $variableGroup);
+		} // END - if
+	}
+
+	/**
+	 * Assigns the last loaded raw template content with a given variable
+	 *
+	 * @param	$templateName	Name of the template we want to assign
+	 * @param	$variableName	Name of the variable we want to assign
+	 * @return	void
+	 */
+	public function assignTemplateWithVariable ($templateName, $variableName) {
+		// Get the content from last loaded raw template
+		$content = $this->getRawTemplateData();
+
+		// Assign the variable
+		$this->assignVariable($variableName, $content);
+
+		// Purge raw content
+		$this->setRawTemplateData('');
+	}
+
 	/**
 	 * Assign a given congfiguration variable with a value
 	 *
@@ -1176,6 +1194,26 @@ class BaseTemplateEngine extends BaseFrameworkSystem {
 		$this->setVariable('config', $variableName, $this->getConfigInstance()->getConfigEntry($variableName));
 	}
 
+	/**
+	 * Assigns all the application data with template variables
+	 *
+	 * @param	$applicationInstance	A manageable application instance
+	 * @return	void
+	 */
+	public function assignApplicationData (ManageableApplication $applicationInstance) {
+		// Get long name and assign it
+		$this->assignVariable('app_full_name' , $applicationInstance->getAppName());
+
+		// Get short name and assign it
+		$this->assignVariable('app_short_name', $applicationInstance->getAppShortName());
+
+		// Get version number and assign it
+		$this->assignVariable('app_version'   , $applicationInstance->getAppVersion());
+
+		// Assign extra application-depending data
+		$applicationInstance->assignExtraTemplateData($this);
+	}
+
 	/**
 	 * Load a specified code template into the engine
 	 *
@@ -1399,24 +1437,6 @@ class BaseTemplateEngine extends BaseFrameworkSystem {
 		return $this->helpers[$helperName];
 	}
 
-	/**
-	 * Assigns the last loaded raw template content with a given variable
-	 *
-	 * @param	$templateName	Name of the template we want to assign
-	 * @param	$variableName	Name of the variable we want to assign
-	 * @return	void
-	 */
-	public function assignTemplateWithVariable ($templateName, $variableName) {
-		// Get the content from last loaded raw template
-		$content = $this->getRawTemplateData();
-
-		// Assign the variable
-		$this->assignVariable($variableName, $content);
-
-		// Purge raw content
-		$this->setRawTemplateData('');
-	}
-
 	/**
 	 * Transfers the content of this template engine to a given response instance
 	 *
@@ -1428,26 +1448,6 @@ class BaseTemplateEngine extends BaseFrameworkSystem {
 		$responseInstance->writeToBody($this->getCompiledData());
 	}
 
-	/**
-	 * Assigns all the application data with template variables
-	 *
-	 * @param	$applicationInstance	A manageable application instance
-	 * @return	void
-	 */
-	public function assignApplicationData (ManageableApplication $applicationInstance) {
-		// Get long name and assign it
-		$this->assignVariable('app_full_name' , $applicationInstance->getAppName());
-
-		// Get short name and assign it
-		$this->assignVariable('app_short_name', $applicationInstance->getAppShortName());
-
-		// Get version number and assign it
-		$this->assignVariable('app_version'   , $applicationInstance->getAppVersion());
-
-		// Assign extra application-depending data
-		$applicationInstance->assignExtraTemplateData($this);
-	}
-
 	/**
 	 * "Compiles" a variable by replacing {?var?} with it's content
 	 *