]> git.mxchange.org Git - core.git/blobdiff - framework/main/classes/template/class_BaseTemplateEngine.php
Continued:
[core.git] / framework / main / classes / template / class_BaseTemplateEngine.php
index 01ff9a92ede901e7b3925676badebae3a48def26..8c09dfbf91a01dfa65b5c601a73932a3500a3181 100644 (file)
@@ -7,9 +7,13 @@ use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
 use Org\Mxchange\CoreFramework\EntryPoint\ApplicationEntryPoint;
 use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
 use Org\Mxchange\CoreFramework\Filesystem\FileNotFoundException;
+use Org\Mxchange\CoreFramework\Generic\NullPointerException;
 use Org\Mxchange\CoreFramework\Manager\ManageableApplication;
 use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem;
+use Org\Mxchange\CoreFramework\Registry\GenericRegistry;
 use Org\Mxchange\CoreFramework\Response\Responseable;
+use Org\Mxchange\CoreFramework\Traits\Handler\Io\IoHandlerTrait;
+use Org\Mxchange\CoreFramework\Utils\String\StringUtils;
 
 // Import SPL stuff
 use \InvalidArgumentException;
@@ -20,7 +24,7 @@ use \SplFileInfo;
  *
  * @author             Roland Haeder <webmaster@shipsimu.org>
  * @version            0.0.0
- * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2017 Core Developer Team
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2020 Core Developer Team
  * @license            GNU GPL 3.0 or any newer version
  * @link               http://www.shipsimu.org
  *
@@ -38,6 +42,15 @@ use \SplFileInfo;
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 abstract class BaseTemplateEngine extends BaseFrameworkSystem {
+       // Load traits
+       use IoHandlerTrait;
+
+       // Exception codes for the template engine
+       const EXCEPTION_TEMPLATE_TYPE_IS_UNEXPECTED   = 0x110;
+       const EXCEPTION_TEMPLATE_CONTAINS_INVALID_VAR = 0x111;
+       const EXCEPTION_INVALID_VIEW_HELPER           = 0x112;
+       const EXCEPTION_VARIABLE_IS_MISSING           = 0x113;
+
        /**
         * The local path name where all templates and sub folders for special
         * templates are stored. We will internally determine the language plus
@@ -88,17 +101,17 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
        /**
         * The variable stack for the templates
         */
-       private $varStack = array();
+       private $varStack = [];
 
        /**
         * Loaded templates for recursive protection and detection
         */
-       private $loadedTemplates = array();
+       private $loadedTemplates = [];
 
        /**
         * Compiled templates for recursive protection and detection
         */
-       private $compiledTemplates = array();
+       private $compiledTemplates = [];
 
        /**
         * Loaded raw template data
@@ -130,7 +143,7 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
        /**
         * Loaded helpers
         */
-       private $helpers = array();
+       private $helpers = [];
 
        /**
         * Current variable group
@@ -140,7 +153,7 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
        /**
         * All template groups except "general"
         */
-       private $variableGroups = array();
+       private $variableGroups = [];
 
        /**
         * Code begin
@@ -157,24 +170,13 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
         */
        private $languageSupport = true;
 
-       /**
-        * XML compacting is disabled by default
-        */
-       private $xmlCompacting = false;
-
-       // Exception codes for the template engine
-       const EXCEPTION_TEMPLATE_TYPE_IS_UNEXPECTED   = 0x110;
-       const EXCEPTION_TEMPLATE_CONTAINS_INVALID_VAR = 0x111;
-       const EXCEPTION_INVALID_VIEW_HELPER           = 0x112;
-       const EXCEPTION_VARIABLE_IS_MISSING           = 0x113;
-
        /**
         * Protected constructor
         *
         * @param       $className      Name of the class
         * @return      void
         */
-       protected function __construct ($className) {
+       protected function __construct (string $className) {
                // Call parent constructor
                parent::__construct($className);
 
@@ -192,9 +194,9 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
         * @param       $variableGroup  Optional variable group to look in
         * @return      $index                  false means not found, >=0 means found on a specific index
         */
-       private function getVariableIndex ($variableName, $variableGroup = NULL) {
+       private function getVariableIndex (string $variableName, string $variableGroup = NULL) {
                // Replace all dashes to underscores to match variables with configuration entries
-               $variableName = trim(self::convertDashesToUnderscores($variableName));
+               $variableName = trim(StringUtils::convertDashesToUnderscores($variableName));
 
                // First everything is not found
                $found = false;
@@ -204,7 +206,7 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
                        // Use current group
                        //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(__METHOD__.' currGroup=' . $this->currGroup . ' set as stack!');
                        $variableGroup = $this->currGroup;
-               } // END - if
+               }
 
                // Is the group there?
                if ($this->isVarStackSet($variableGroup)) {
@@ -217,9 +219,9 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
                                        //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(__METHOD__.':FOUND!');
                                        $found = $index;
                                        break;
-                               } // END - if
-                       } // END - foreach
-               } // END - if
+                               }
+                       }
+               }
 
                // Return the current position
                return $found;
@@ -231,7 +233,7 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
         * @param       $variableGroup  Variable group to check
         * @return      $isSet                  Whether the given variable group is set
         */
-       protected final function isVarStackSet ($variableGroup) {
+       protected final function isVarStackSet (string $variableGroup) {
                // Check it
                $isSet = isset($this->varStack[$variableGroup]);
 
@@ -245,7 +247,7 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
         * @param       $variableGroup  Variable group to check
         * @return      $varStack               Found variable group
         */
-       public final function getVarStack ($variableGroup) {
+       public final function getVarStack (string $variableGroup) {
                return $this->varStack[$variableGroup];
        }
 
@@ -256,7 +258,7 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
         * @param       $varStack               Variable stack to check
         * @return      void
         */
-       protected final function setVarStack ($variableGroup, array $varStack) {
+       protected final function setVarStack (string $variableGroup, array $varStack) {
                $this->varStack[$variableGroup]  = $varStack;
        }
 
@@ -267,9 +269,9 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
         * @param       $variableGroup  Optional variable group to look in
         * @return      $content                Content of the variable or null if not found
         */
-       protected function readVariable ($variableName, $variableGroup = NULL) {
+       protected function readVariable (string $variableName, string $variableGroup = NULL) {
                // Replace all dashes to underscores to match variables with configuration entries
-               $variableName = trim(self::convertDashesToUnderscores($variableName));
+               $variableName = trim(StringUtils::convertDashesToUnderscores($variableName));
 
                // First everything is not found
                $content = NULL;
@@ -279,7 +281,7 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
                        // Use current group
                        //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(__METHOD__.' currGroup=' . $this->currGroup . ' set as stack!');
                        $variableGroup = $this->currGroup;
-               } // END - if
+               }
 
                // Get variable index
                $found = $this->getVariableIndex($variableName, $variableGroup);
@@ -288,7 +290,7 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
                if ($found !== false) {
                        // Read it
                        $content = $this->getVariableValue($variableGroup, $found);
-               } // END - if
+               }
 
                // Return the current position
                //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(__METHOD__.': variableGroup=' . $variableGroup . ',variableName=' . $variableName . ', content[' . gettype($content) . ']=' . $content);
@@ -302,7 +304,7 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
         * @param       $value                  Value we want to store in the variable
         * @return      void
         */
-       private function addVariable ($variableName, $value) {
+       private function addVariable (string $variableName, $value) {
                // Set general variable group
                $this->setVariableGroup('general');
 
@@ -317,13 +319,13 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
         */
        private function readCurrentGroup () {
                // Default is not found
-               $result = array();
+               $result = [];
 
                // Is the group there?
                if ($this->isVarStackSet($this->currGroup)) {
                        // Then use it
                        $result = $this->getVarStack($this->currGroup);
-               } // END - if
+               }
 
                // Return result
                return $result;
@@ -336,7 +338,7 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
         * @param       $add            Whether add this group
         * @return      void
         */
-       public function setVariableGroup ($groupName, $add = true) {
+       public function setVariableGroup (string $groupName, bool $add = true) {
                // Set group name
                //* DEBIG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(__METHOD__.': currGroup=' . $groupName);
                $this->currGroup = $groupName;
@@ -344,7 +346,7 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
                // Skip group 'general'
                if (($groupName != 'general') && ($add === true)) {
                        $this->variableGroups[$groupName] = 'OK';
-               } // END - if
+               }
        }
 
 
@@ -355,9 +357,9 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
         * @param       $value                  Value to store in variable
         * @return      void
         */
-       public function addGroupVariable ($variableName, $value) {
+       public function addGroupVariable (string $variableName, $value) {
                // Replace all dashes to underscores to match variables with configuration entries
-               $variableName = trim(self::convertDashesToUnderscores($variableName));
+               $variableName = trim(StringUtils::convertDashesToUnderscores($variableName));
 
                // Debug message
                //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(__METHOD__.': group=' . $this->currGroup . ', variableName=' . $variableName . ', value=' . $value);
@@ -379,7 +381,7 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
         * @param       $index          Index in variable array
         * @return      $value          Value to set
         */
-       private function getVariableValue ($variableGroup, $index) {
+       private function getVariableValue (string $variableGroup, int $index) {
                // Return it
                return $this->varStack[$variableGroup][$index]['value'];
        }
@@ -392,9 +394,9 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
         * @return      void
         * @throws      NoVariableException     If the given variable is not found
         */
-       private function modifyVariable ($variableName, $value) {
+       private function modifyVariable (string $variableName, $value) {
                // Replace all dashes to underscores to match variables with configuration entries
-               $variableName = trim(self::convertDashesToUnderscores($variableName));
+               $variableName = trim(StringUtils::convertDashesToUnderscores($variableName));
 
                // Get index for variable
                $index = $this->getVariableIndex($variableName);
@@ -403,7 +405,7 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
                if ($index === false) {
                        // Unset variables cannot be modified
                        throw new NoVariableException(array($this, $variableName, $value), self::EXCEPTION_VARIABLE_IS_MISSING);
-               } // END - if
+               }
 
                // Then modify it
                $this->setVariableValue($this->currGroup, $index, $value);
@@ -417,7 +419,7 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
         * @param       $value          Value to set
         * @return      void
         */
-       private function setVariableValue ($variableGroup, $index, $value) {
+       private function setVariableValue (string $variableGroup, int $index, $value) {
                $this->varStack[$variableGroup][$index]['value'] = $value;
        }
 
@@ -431,9 +433,9 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
         * @param       $value                  Value to set
         * @return      void
         */
-       protected function setVariable ($variableGroup, $variableName, $value) {
+       protected function setVariable (string $variableGroup, string $variableName, $value) {
                // Replace all dashes to underscores to match variables with configuration entries
-               $variableName = trim(self::convertDashesToUnderscores($variableName));
+               $variableName = trim(StringUtils::convertDashesToUnderscores($variableName));
 
                // Get index for variable
                $index = $this->getVariableIndex($variableName);
@@ -443,8 +445,8 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
                        // Is the stack there?
                        if (!isset($this->varStack[$variableGroup])) {
                                // Then initialize it here
-                               $this->varStack[$variableGroup] = array();
-                       } // END - if
+                               $this->varStack[$variableGroup] = [];
+                       }
 
                        // Not found, add it
                        array_push($this->varStack[$variableGroup], $this->generateVariableArray($variableName, $value));
@@ -462,9 +464,9 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
         * @param       $value                  Value to set
         * @return      $varData                Variable data array
         */
-       private function generateVariableArray ($variableName, $value) {
+       private function generateVariableArray (string $variableName, $value) {
                // Replace all dashes to underscores to match variables with configuration entries
-               $variableName = trim(self::convertDashesToUnderscores($variableName));
+               $variableName = trim(StringUtils::convertDashesToUnderscores($variableName));
 
                // Generate the temporary array
                $varData = array(
@@ -483,8 +485,8 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
         * @param       $templateType   The current template's type
         * @return      void
         */
-       protected final function setTemplateType ($templateType) {
-               $this->templateType = (string) $templateType;
+       protected final function setTemplateType (string $templateType) {
+               $this->templateType = $templateType;
        }
 
        /**
@@ -521,9 +523,9 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
         * @param               $templateBasePath               The relative base path for all templates
         * @return      void
         */
-       protected final function setTemplateBasePath ($templateBasePath) {
+       protected final function setTemplateBasePath (string $templateBasePath) {
                // And set it
-               $this->templateBasePath = (string) $templateBasePath;
+               $this->templateBasePath = $templateBasePath;
        }
 
        /**
@@ -553,9 +555,9 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
         *                                                      templates
         * @return      void
         */
-       protected final function setRawTemplateExtension ($templateExtension) {
+       protected final function setRawTemplateExtension (string $templateExtension) {
                // And set it
-               $this->templateExtension = (string) $templateExtension;
+               $this->templateExtension = $templateExtension;
        }
 
        /**
@@ -565,9 +567,9 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
         *                                                      templates
         * @return      void
         */
-       protected final function setCodeTemplateExtension ($codeExtension) {
+       protected final function setCodeTemplateExtension (string $codeExtension) {
                // And set it
-               $this->codeExtension = (string) $codeExtension;
+               $this->codeExtension = $codeExtension;
        }
 
        /**
@@ -599,9 +601,9 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
         *                                                              templates
         * @return      void
         */
-       protected final function setCompileOutputPath ($compileOutputPath) {
+       protected final function setCompileOutputPath (string $compileOutputPath) {
                // And set it
-               $this->compileOutputPath = (string) $compileOutputPath;
+               $this->compileOutputPath = $compileOutputPath;
        }
 
        /**
@@ -611,18 +613,18 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
         * @param       $variableGroup  Variable group (default: currGroup)
         * @return      void
         */
-       protected final function unsetVariableStackOffset ($index, $variableGroup = NULL) {
+       protected final function unsetVariableStackOffset (int $index, string $variableGroup = NULL) {
                // Is the variable group not set?
                if (is_null($variableGroup)) {
                        // Then set it to current
                        $variableGroup = $this->currGroup;
-               } // END - if
+               }
 
                // Is the entry there?
                if (!isset($this->varStack[$variableGroup][$index])) {
                        // Abort here, we need fixing!
                        $this->debugInstance();
-               } // END - if
+               }
 
                // Remove it
                unset($this->varStack[$variableGroup][$index]);
@@ -634,11 +636,11 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
         * @param       $rawTemplateData        The raw data from the template
         * @return      void
         */
-       protected final function setRawTemplateData ($rawTemplateData) {
+       protected final function setRawTemplateData (string $rawTemplateData) {
                // And store it in this class
                //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(__METHOD__.': ' . strlen($rawTemplateData) . ' Bytes set.');
                //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(__METHOD__.': ' . $this->currGroup . ' variables: ' . count($this->getVarStack($this->currGroup)) . ', groups=' . count($this->varStack));
-               $this->rawTemplateData = (string) $rawTemplateData;
+               $this->rawTemplateData = $rawTemplateData;
        }
 
        /**
@@ -647,19 +649,20 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
         * @return      $rawTemplateData        The raw data from the template
         */
        public final function getRawTemplateData () {
-               //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-TEMPLATE[' . __METHOD__ . ':' . __LINE__ . ']: ' . strlen($this->rawTemplateData) . ' Bytes read.');
+               //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-TEMPLATE: ' . strlen($this->rawTemplateData) . ' Bytes read.');
                return $this->rawTemplateData;
        }
 
        /**
         * Private setter for compiled templates
         *
+        * @param       $compiledData   Compiled template data
         * @return      void
         */
-       private final function setCompiledData ($compiledData) {
+       private final function setCompiledData (string $compiledData) {
                // And store it in this class
-               //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-TEMPLATE[' . __METHOD__ . ':' . __LINE__ . ']: ' . strlen($compiledData) . ' Bytes set.');
-               $this->compiledData = (string) $compiledData;
+               //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-TEMPLATE: ' . strlen($compiledData) . ' Bytes set.');
+               $this->compiledData = $compiledData;
        }
 
        /**
@@ -668,7 +671,7 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
         * @return      $compiledData   Compiled template data
         */
        public final function getCompiledData () {
-               //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-TEMPLATE[' . __METHOD__ . ':' . __LINE__ . ']: ' . strlen($this->compiledData) . ' Bytes read.');
+               //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-TEMPLATE: ' . strlen($this->compiledData) . ' Bytes read.');
                return $this->compiledData;
        }
 
@@ -680,14 +683,14 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
         * @return      void
         * @throws      FileNotFoundException   If the template was not found
         */
-       protected function loadTemplate ($templateName, $extOther = '') {
+       protected function loadTemplate (string $templateName, string $extOther = '') {
                // Get extension for the template if empty
                if (empty($extOther)) {
                        // None provided, so get the raw one
                        $ext = $this->getRawTemplateExtension();
                } else {
                        // Then use it!
-                       $ext = (string) $extOther;
+                       $ext = $extOther;
                }
 
                /*
@@ -710,7 +713,7 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
                        $this->loadRawTemplateData($fileInstance);
                } catch (FileNotFoundException $e) {
                        // If we shall load a code-template we need to switch the file extension
-                       if (($this->getTemplateType() != $this->getConfigInstance()->getConfigEntry('html_template_type')) && (empty($extOther))) {
+                       if (($this->getTemplateType() != FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('html_template_type')) && (empty($extOther))) {
                                // Switch over to the code-template extension and try it again
                                $ext = $this->getCodeTemplateExtension();
 
@@ -731,10 +734,8 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
         * @return      void
         */
        private function loadRawTemplateData (SplFileInfo $fileInstance) {
-               // Some debug code to look on the file which is being loaded
-               //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-TEMPLATE[' . __METHOD__ . ':' . __LINE__ . ']: fileInstance=' . $fileInstance);
-
                // Load the raw template
+               //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-TEMPLATE: fileInstance=' . $fileInstance);
                $rawTemplateData = $this->getFileIoInstance()->loadFileContents($fileInstance);
 
                // Store the template's contents into this class
@@ -748,17 +749,15 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
         * Try to assign an extracted template variable as a "content" or 'config'
         * variable.
         *
-        * @param       $variableName           The variable's name (shall be content or config)
+        * @param       $variableName   The variable's name (shall be content or config)
         *                                                      by default
         * @param       $variableName   The variable we want to assign
         * @return      void
         */
-       private function assignTemplateVariable ($variableName, $var) {
+       private function assignTemplateVariable (string $variableName, $var) {
                // Replace all dashes to underscores to match variables with configuration entries
-               $variableName = trim(self::convertDashesToUnderscores($variableName));
-
-               // Debug message
-               //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-TEMPLATE[' . __METHOD__ . ':' . __LINE__ . ']: variableName=' . $variableName . ',variableName=' . $variableName);
+               //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-TEMPLATE: variableName=' . $variableName . ',var=' . $var);
+               $variableName = trim(StringUtils::convertDashesToUnderscores($variableName));
 
                // Is it not a config variable?
                if ($variableName != 'config') {
@@ -776,16 +775,11 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
         * @param       $rawData        The raw template data we shall analyze
         * @return      void
         */
-       private function extractVariablesFromRawData ($rawData) {
-               // Cast to string
-               $rawData = (string) $rawData;
-
+       private function extractVariablesFromRawData (string $rawData) {
                // Search for variables
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-TEMPLATE:rawData(' . strlen($rawData) . ')=' . $rawData . ',variableMatches=' . print_r($variableMatches, true));
                preg_match_all('/\$(\w+)(\[(\w+)\])?/', $rawData, $variableMatches);
 
-               // Debug message
-               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-TEMPLATE[' . __METHOD__ . ':' . __LINE__ . ']:rawData(' . strlen($rawData) . ')=' . $rawData . ',variableMatches=' . print_r($variableMatches, true));
-
                // Did we find some variables?
                if ((is_array($variableMatches)) && (count($variableMatches) == 4) && (count($variableMatches[0]) > 0)) {
                        // Initialize all missing variables
@@ -797,9 +791,9 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
                                if (!empty($var)) {
                                        // Try to assign it, empty strings are being ignored
                                        $this->assignTemplateVariable($variableName, $var);
-                               } // END - if
-                       } // END - foreach
-               } // END - if
+                               }
+                       }
+               }
        }
 
        /**
@@ -823,9 +817,9 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
                // Initialize some arrays
                if (is_null($this->loadedRawData)) {
                        // Initialize both
-                       $this->loadedRawData = array();
-                       $this->rawTemplates = array();
-               } // END - if
+                       $this->loadedRawData = [];
+                       $this->rawTemplates = [];
+               }
 
                // Load all requested templates
                foreach ($templateMatches[1] as $template) {
@@ -833,7 +827,7 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
                        // RECURSIVE PROTECTION! BE CAREFUL HERE!
                        if ((!isset($this->loadedRawData[$template])) && (!in_array($template, $this->loadedTemplates))) {
                                // Debug message
-                               //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-TEMPLATE[' . __METHOD__ . ':' . __LINE__ . ']:template=' . $template);
+                               //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-TEMPLATE:template=' . $template);
 
                                // Template not found, but maybe variable assigned?
                                if ($this->getVariableIndex($template) !== false) {
@@ -857,8 +851,8 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
                                                array_push($this->rawTemplates, $template);
                                        }
                                }
-                       } // END - if
-               } // END - foreach
+                       }
+               }
 
                // Restore the raw template data
                $this->setRawTemplateData($backup);
@@ -871,12 +865,12 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
         * @param       $template       The template's name
         * @return      void
         */
-       private function compileCode ($code, $template) {
+       private function compileCode (string $code, string $template) {
                // Is this template already compiled?
                if (in_array($template, $this->compiledTemplates)) {
                        // Abort here...
                        return;
-               } // END - if
+               }
 
                // Remember this template being compiled
                array_push($this->compiledTemplates, $template);
@@ -924,8 +918,8 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
 
                                // Set the new raw data
                                $this->setRawTemplateData($rawData);
-                       } // END - if
-               } // END - foreach
+                       }
+               }
        }
 
        /**
@@ -955,8 +949,8 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
                                        // This template was never found. We silently ignore it
                                        unset($this->rawTemplates[$key]);
                                }
-                       } // END - foreach
-               } // END - if
+                       }
+               }
        }
 
        /**
@@ -968,21 +962,21 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
         */
        private function assignAllVariables (array $varMatches) {
                // Debug message
-               //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-TEMPLATE[' . __METHOD__ . ':' . __LINE__ . ']:varMatches()=' . count($varMatches));
+               //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-TEMPLATE:varMatches()=' . count($varMatches));
 
                // Search for all variables
                foreach ($varMatches[1] as $key => $var) {
                        // Replace all dashes to underscores to match variables with configuration entries
-                       $var = trim(self::convertDashesToUnderscores($var));
+                       $var = trim(StringUtils::convertDashesToUnderscores($var));
 
                        // Debug message
-                       self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-TEMPLATE[' . __METHOD__ . ':' . __LINE__ . ']:key=' . $key . ',var=' . $var);
+                       self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-TEMPLATE:key=' . $key . ',var=' . $var);
 
                        // Detect leading equals
                        if (substr($varMatches[2][$key], 0, 1) == '=') {
                                // Remove and cast it
                                $varMatches[2][$key] = (string) substr($varMatches[2][$key], 1);
-                       } // END - if
+                       }
 
                        // Do we have some quotes left and right side? Then it is free text
                        if ((substr($varMatches[2][$key], 0, 1) == '"') && (substr($varMatches[2][$key], -1, 1) == '"')) {
@@ -992,7 +986,7 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
                                // @TODO Non-string found so we need some deeper analysis...
                                ApplicationEntryPoint::exitApplication('Deeper analysis not yet implemented!');
                        }
-               } // END - foreach
+               }
        }
 
        /**
@@ -1003,21 +997,21 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
         */
        private function compileRawTemplateData (array $templateMatches) {
                // Debug message
-               //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-TEMPLATE[' . __METHOD__ . ':' . __LINE__ . ']:loadedRawData()= ' .count($this->loadedRawData));
+               //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-TEMPLATE:loadedRawData()= ' .count($this->loadedRawData));
 
                // Are some code-templates found which we need to compile?
                if (count($this->loadedRawData) > 0) {
                        // Then compile all!
                        foreach ($this->loadedRawData as $template => $code) {
                                // Debug message
-                               //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-TEMPLATE[' . __METHOD__ . ':' . __LINE__ . ']:template=' . $template . ',code(' . strlen($code) . ')=' . $code);
+                               //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-TEMPLATE:template=' . $template . ',code(' . strlen($code) . ')=' . $code);
 
                                // Is this template already compiled?
                                if (in_array($template, $this->compiledTemplates)) {
                                        // Then skip it
-                                       //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-TEMPLATE[' . __METHOD__ . ':' . __LINE__ . ']: Template ' . $template . ' already compiled. SKIPPED!');
+                                       //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-TEMPLATE: Template ' . $template . ' already compiled. SKIPPED!');
                                        continue;
-                               } // END - if
+                               }
 
                                // Search for the template
                                $foundIndex = array_search($template, $templateMatches[1]);
@@ -1026,19 +1020,19 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
                                if (($foundIndex !== false) && (isset($templateMatches[3][$foundIndex]))) {
                                        // Split it up with another reg. exp. into variable=value pairs
                                        preg_match_all($this->regExpVarValue, $templateMatches[3][$foundIndex], $varMatches);
-                                       //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-TEMPLATE[' . __METHOD__ . ':' . __LINE__ . ']:varMatches=' . print_r($varMatches, true));
+                                       //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-TEMPLATE:varMatches=' . print_r($varMatches, true));
 
                                        // Assign all variables
                                        $this->assignAllVariables($varMatches);
-                               } // END - if (isset($templateMatches ...
+                               }
 
                                // Compile the loaded template
                                $this->compileCode($code, $template);
-                       } // END - foreach ($this->loadedRawData ...
+                       }
 
                        // Insert all templates
                        $this->insertAllTemplates($templateMatches);
-               } // END - if (count($this->loadedRawData) ...
+               }
        }
 
        /**
@@ -1062,18 +1056,18 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
        private function finalizeVariableCompilation () {
                // Get the content
                $content = $this->getRawTemplateData();
-               //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-TEMPLATE[' . __METHOD__ . ':' . __LINE__ . ']: content before=' . strlen($content) . ' (' . md5($content) . ')');
+               //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-TEMPLATE: content before=' . strlen($content) . ' (' . md5($content) . ')');
 
                // Do we have the stack?
                if (!$this->isVarStackSet('general')) {
                        // Abort here silently
                        // @TODO This silent abort should be logged, maybe.
                        return;
-               } // END - if
+               }
 
                // Walk through all variables
                foreach ($this->getVarStack('general') as $currEntry) {
-                       //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-TEMPLATE[' . __METHOD__ . ':' . __LINE__ . ']: name=' . $currEntry['name'] . ', value=<pre>' . htmlentities($currEntry['value']) . '</pre>');
+                       //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-TEMPLATE: name=' . $currEntry['name'] . ', value=<pre>' . htmlentities($currEntry['value']) . '</pre>');
                        // Replace all [$var] or {?$var?} with the content
                        // @TODO Old behaviour, will become obsolete!
                        $content = str_replace('$content[' . $currEntry['name'] . ']', $currEntry['value'], $content);
@@ -1083,11 +1077,10 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
 
                        // The new behaviour
                        $content = str_replace('{?' . $currEntry['name'] . '?}', $currEntry['value'], $content);
-               } // END - for
-
-               //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-TEMPLATE[' . __METHOD__ . ':' . __LINE__ . ']: content after=' . strlen($content) . ' (' . md5($content) . ')');
+               }
 
                // Set the content back
+               //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-TEMPLATE: content after=' . strlen($content) . ' (' . md5($content) . ')');
                $this->setRawTemplateData($content);
        }
 
@@ -1098,9 +1091,9 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
         *                                              'html' by default
         * @return      void
         */
-       public function loadHtmlTemplate ($template) {
+       public function loadHtmlTemplate (string $template) {
                // Set template type
-               $this->setTemplateType($this->getConfigInstance()->getConfigEntry('html_template_type'));
+               $this->setTemplateType(FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('html_template_type'));
 
                // Load the special template
                $this->loadTemplate($template);
@@ -1114,15 +1107,15 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
         * @return      void
         * @throws      InvalidArgumentException        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(self::convertDashesToUnderscores($variableName));
-
-               // Empty variable found?
+       public final function assignVariable (string $variableName, $value) {
+               // Validate parameter
                if (empty($variableName)) {
                        // Throw an exception
                        throw new InvalidArgumentException('Parameter "variableName" is empty');
-               } // END - if
+               }
+
+               // Replace all dashes to underscores to match variables with configuration entries
+               $variableName = trim(StringUtils::convertDashesToUnderscores($variableName));
 
                // First search for the variable if it was already added
                $index = $this->getVariableIndex($variableName);
@@ -1130,11 +1123,11 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
                // Was it found?
                if ($index === false) {
                        // Add it to the stack
-                       //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-TEMPLATE[' . __METHOD__ . ':' . __LINE__ . ']:ADD: ' . $variableName . '[' . gettype($value) . ']=' . $value);
+                       //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-TEMPLATE:ADD: ' . $variableName . '[' . gettype($value) . ']=' . $value);
                        $this->addVariable($variableName, $value);
                } elseif (!empty($value)) {
                        // Modify the stack entry
-                       //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-TEMPLATE[' . __METHOD__ . ':' . __LINE__ . ']:MOD: ' . $variableName . '[' . gettype($value) . ']=' . $value);
+                       //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-TEMPLATE:MOD: ' . $variableName . '[' . gettype($value) . ']=' . $value);
                        $this->modifyVariable($variableName, $value);
                }
        }
@@ -1146,16 +1139,16 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
         * @param       $variableGroup  Name of variable group (default: 'general')
         * @return      void
         */
-       public final function removeVariable ($variableName, $variableGroup = 'general') {
+       public final function removeVariable (string $variableName, string $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__, __LINE__)->debugOutput('BASE-TEMPLATE[' . __METHOD__ . ':' . __LINE__ . ']:UNSET: variableGroup=' . $variableGroup . ',variableName=' . $variableName . ',index=' . $index);
+                       //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-TEMPLATE:UNSET: variableGroup=' . $variableGroup . ',variableName=' . $variableName . ',index=' . $index);
                        $this->unsetVariableStackOffset($index, $variableGroup);
-               } // END - if
+               }
        }
 
        /**
@@ -1165,7 +1158,7 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
         * @param       $variableName   Name of the variable we want to assign
         * @return      void
         */
-       public function assignTemplateWithVariable ($templateName, $variableName) {
+       public function assignTemplateWithVariable (string $templateName, string $variableName) {
                // Get the content from last loaded raw template
                $content = $this->getRawTemplateData();
 
@@ -1182,13 +1175,13 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
         * @param       $variableName   The configuration variable we want to assign
         * @return      void
         */
-       public function assignConfigVariable ($variableName) {
+       public function assignConfigVariable (string $variableName) {
                // Replace all dashes to underscores to match variables with configuration entries
-               $variableName = trim(self::convertDashesToUnderscores($variableName));
+               $variableName = trim(StringUtils::convertDashesToUnderscores($variableName));
 
                // Sweet and simple...
-               //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-TEMPLATE[' . __METHOD__ . ':' . __LINE__ . ']: variableName=' . $variableName . ',getConfigEntry()=' . $this->getConfigInstance()->getConfigEntry($variableName));
-               $this->assignVariable($variableName, $this->getConfigInstance()->getConfigEntry($variableName));
+               //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-TEMPLATE: variableName=' . $variableName . ',getConfigEntry()=' . FrameworkBootstrap::getConfigurationInstance()->getConfigEntry($variableName));
+               $this->assignVariable($variableName, FrameworkBootstrap::getConfigurationInstance()->getConfigEntry($variableName));
        }
 
        /**
@@ -1206,16 +1199,18 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
                foreach ($variables as $name => $value) {
                        // Set variable with name for 'config' group
                        $this->assignVariable($name, $value);
-               } // END - foreach
+               }
        }
 
        /**
         * Assigns all the application data with template variables
         *
-        * @param       $applicationInstance    A manageable application instance
         * @return      void
         */
-       public function assignApplicationData (ManageableApplication $applicationInstance) {
+       public function assignApplicationData () {
+               // Get application instance
+               $applicationInstance = GenericRegistry::getRegistry()->getInstance('application');
+
                // Get long name and assign it
                $this->assignVariable('app_full_name' , $applicationInstance->getAppName());
 
@@ -1236,9 +1231,9 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
         *                                              located in 'code' by default
         * @return      void
         */
-       public function loadCodeTemplate ($template) {
+       public function loadCodeTemplate (string $template) {
                // Set template type
-               $this->setTemplateType($this->getConfigInstance()->getConfigEntry('code_' . FrameworkBootstrap::getRequestTypeFromSystem() . '_template_type'));
+               $this->setTemplateType(FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('code_' . FrameworkBootstrap::getRequestTypeFromSystem() . '_template_type'));
 
                // Load the special template
                $this->loadTemplate($template);
@@ -1251,9 +1246,9 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
         *                                              located in 'emails' by default
         * @return      void
         */
-       public function loadEmailTemplate ($template) {
+       public function loadEmailTemplate (string $template) {
                // Set template type
-               $this->setTemplateType($this->getConfigInstance()->getConfigEntry('email_template_type'));
+               $this->setTemplateType(FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('email_template_type'));
 
                // Load the special template
                $this->loadTemplate($template);
@@ -1270,9 +1265,9 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
                // Do we have the stack?
                if (!$this->isVarStackSet('general')) {
                        // Abort here silently
-                       //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-TEMPLATE[' . __METHOD__ . ':' . __LINE__ . ']: Aborted, variable stack general not found!');
+                       //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-TEMPLATE: Aborted, variable stack general not found!');
                        return;
-               } // END - if
+               }
 
                // Iterate through all general variables
                foreach ($this->getVarStack('general') as $index => $currVariable) {
@@ -1280,21 +1275,21 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
                        $value = $this->compileRawCode($this->readVariable($currVariable['name']), true);
 
                        // Debug message
-                       //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-TEMPLATE[' . __METHOD__ . ':' . __LINE__ . ']: name=' . $currVariable['name'] . ',value=' . $value);
+                       //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-TEMPLATE: name=' . $currVariable['name'] . ',value=' . $value);
 
                        // Remove it from stack
                        $this->removeVariable($currVariable['name'], 'general');
-                       //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-TEMPLATE[' . __METHOD__ . ':' . __LINE__ . ']: value='. $value . ',name=' . $currVariable['name'] . ',index=' . $index);
+                       //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-TEMPLATE: value='. $value . ',name=' . $currVariable['name'] . ',index=' . $index);
 
                        // Is it a configuration key?
-                       if ($this->getConfigInstance()->isConfigurationEntrySet($value)) {
+                       if (FrameworkBootstrap::getConfigurationInstance()->isConfigurationEntrySet($value)) {
                                // The value itself is a configuration entry
                                $this->assignConfigVariable($value);
                        } else {
                                // Re-assign the value directly
                                $this->assignVariable($currVariable['name'], $value);
                        }
-               } // END - foreach
+               }
        }
 
        /**
@@ -1305,15 +1300,15 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
         */
        public final function compileVariables () {
                // Initialize the $content array
-               $validVar = $this->getConfigInstance()->getConfigEntry('tpl_valid_var');
-               $dummy = array();
+               $validVar = FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('tpl_valid_var');
+               $dummy = [];
 
                // Iterate through all general variables
                foreach ($this->getVarStack('general') as $currVariable) {
                        // Transfer it's name/value combination to the $content array
-                       //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-TEMPLATE[' . __METHOD__ . ':' . __LINE__ . ']:' . $currVariable['name'] . '=<pre>' . htmlentities($currVariable['value']).'</pre>');
+                       //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-TEMPLATE:' . $currVariable['name'] . '=<pre>' . htmlentities($currVariable['value']).'</pre>');
                        $dummy[$currVariable['name']] = $currVariable['value'];
-               }// END - if
+               }
 
                // Set the new variable (don't remove the second dollar!)
                $$validVar = $dummy;
@@ -1350,7 +1345,7 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
 
                                // And put all together
                                $eval = sprintf('%s<%%php %s %%>%s', $evalLeft, $evalMiddle, $evalRight);
-                       } // END - while
+                       }
 
                        // Prepare PHP code for eval() command
                        $eval = str_replace(
@@ -1372,12 +1367,12 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
 
                                // Output backtrace here
                                $this->debugBackTrace();
-                       } // END - if
+                       }
 
                        // Set raw template data
                        $this->setRawTemplateData($result);
                        $cnt++;
-               } // END - while
+               }
 
                // Final variable assignment
                $this->finalizeVariableCompilation();
@@ -1397,13 +1392,13 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
         */
        public function compileTemplate () {
                // Get code type to make things shorter
-               $codeType = $this->getConfigInstance()->getConfigEntry('code_' . FrameworkBootstrap::getRequestTypeFromSystem() . '_template_type');
+               $codeType = FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('code_' . FrameworkBootstrap::getRequestTypeFromSystem() . '_template_type');
 
                // We will only work with template type "code" from configuration
                if (substr($this->getTemplateType(), 0, strlen($codeType)) != $codeType) {
                        // Abort here
-                       throw new UnexpectedTemplateTypeException(array($this, $this->getTemplateType(), $this->getConfigInstance()->getConfigEntry('code_' . FrameworkBootstrap::getRequestTypeFromSystem() . '_template_type')), self::EXCEPTION_TEMPLATE_TYPE_IS_UNEXPECTED);
-               } // END - if
+                       throw new UnexpectedTemplateTypeException(array($this, $this->getTemplateType(), FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('code_' . FrameworkBootstrap::getRequestTypeFromSystem() . '_template_type')), self::EXCEPTION_TEMPLATE_TYPE_IS_UNEXPECTED);
+               }
 
                // Get the raw data.
                $rawData = $this->getRawTemplateData();
@@ -1418,7 +1413,7 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
                preg_match_all($this->regExpCodeTags, $rawData, $templateMatches);
 
                // Debug message
-               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-TEMPLATE[' . __METHOD__ . ':' . __LINE__ . ']:templateMatches=' . print_r($templateMatches , true));
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-TEMPLATE:templateMatches=' . print_r($templateMatches , true));
 
                // Analyze the matches array
                if ((is_array($templateMatches)) && (count($templateMatches) == 4) && (count($templateMatches[0]) > 0)) {
@@ -1440,8 +1435,8 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
 
                                // Remove the raw template content as well
                                $this->setRawTemplateData('');
-                       } // END - if
-               } // END - if($templateMatches ...
+                       }
+               }
        }
 
        /**
@@ -1450,15 +1445,15 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
         * @param       $helperName             The helper's name
         * @return      void
         */
-       protected function loadViewHelper ($helperName) {
+       protected function loadViewHelper (string $helperName) {
                // Is this view helper loaded?
                if (!isset($this->helpers[$helperName])) {
                        // Create a class name
-                       $className = self::convertToClassName($helperName) . 'ViewHelper';
+                       $className = StringUtils::convertToClassName($helperName) . 'ViewHelper';
 
                        // Generate new instance
                        $this->helpers[$helperName] = ObjectFactory::createObjectByName($className);
-               } // END - if
+               }
 
                // Return the requested instance
                return $this->helpers[$helperName];
@@ -1482,24 +1477,24 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
         * @param       $setMatchAsCode         Sets $match if readVariable() returns empty result
         * @return      $rawCode        Compile code with inserted variable value
         */
-       public function compileRawCode ($rawCode, $setMatchAsCode=false) {
+       public function compileRawCode (string $rawCode, bool $setMatchAsCode = false) {
                // Find the variables
-               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-TEMPLATE[' . __METHOD__ . ':' . __LINE__ . ']:rawCode=<pre>' . htmlentities($rawCode) . '</pre>');
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-TEMPLATE:rawCode=<pre>' . htmlentities($rawCode) . '</pre>');
                preg_match_all($this->regExpVarValue, $rawCode, $varMatches);
 
                // Compile all variables
-               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-TEMPLATE[' . __METHOD__ . ':' . __LINE__ . ']:<pre>' . print_r($varMatches, true) . '</pre>');
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-TEMPLATE:<pre>' . print_r($varMatches, true) . '</pre>');
                foreach ($varMatches[0] as $match) {
                        // Add variable tags around it
                        $varCode = '{?' . $match . '?}';
 
                        // Debug message
-                       //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-TEMPLATE[' . __METHOD__ . ':' . __LINE__ . ']:varCode=' . $varCode);
+                       //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-TEMPLATE:varCode=' . $varCode);
 
                        // Is the variable found in code? (safes some calls)
                        if (strpos($rawCode, $varCode) !== false) {
                                // Debug message
-                               //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-TEMPLATE[' . __METHOD__ . ':' . __LINE__ . ']: match=' . $match . ',rawCode[' . gettype($rawCode) . ']=' . $rawCode);
+                               //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-TEMPLATE: match=' . $match . ',rawCode[' . gettype($rawCode) . ']=' . $rawCode);
 
                                // Use $match as new value or $value from read variable?
                                if ($setMatchAsCode === true) {
@@ -1512,11 +1507,11 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
                                        // Insert value
                                        $rawCode = str_replace($varCode, $value, $rawCode);
                                }
-                       } // END - if
-               } // END - foreach
+                       }
+               }
 
                // Return the compiled data
-               //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-TEMPLATE[' . __METHOD__ . ':' . __LINE__ . ']:rawCode=<pre>' . htmlentities($rawCode) . '</pre>');
+               //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-TEMPLATE:rawCode=<pre>' . htmlentities($rawCode) . '</pre>');
                return $rawCode;
        }
 
@@ -1536,8 +1531,8 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
         * @param       $newName        New name of variable
         * @return      void
         */
-       public function renameVariable ($oldName, $newName) {
-               //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-TEMPLATE[' . __METHOD__ . ':' . __LINE__ . ']: oldName=' . $oldName . ', newName=' . $newName);
+       public function renameVariable (string $oldName, string $newName) {
+               //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-TEMPLATE: oldName=' . $oldName . ', newName=' . $newName);
                // Get raw template code
                $rawData = $this->getRawTemplateData();
 
@@ -1548,41 +1543,14 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
                $this->setRawTemplateData($rawData);
        }
 
-       /**
-        * Renders the given XML content
-        *
-        * @param       $content        Valid XML content or if not set the current loaded raw content
-        * @return      void
-        * @throws      XmlParserException      If an XML error was found
-        */
-       public function renderXmlContent ($content = NULL) {
-               // Is the content set?
-               if (is_null($content)) {
-                       // Get current content
-                       $content = $this->getRawTemplateData();
-               } // END - if
-
-               // Get a XmlParser instance
-               $parserInstance = ObjectFactory::createObjectByConfiguredName('xml_parser_class', array($this));
-
-               // Check if XML compacting is enabled
-               if ($this->isXmlCompactingEnabled()) {
-                       // Yes, so get a decorator class for transparent compacting
-                       $parserInstance = ObjectFactory::createObjectByConfiguredName('deco_compacting_xml_parser_class', array($parserInstance));
-               } // END - if
-
-               // Parse the XML document
-               $parserInstance->parseXmlContent($content);
-       }
-
        /**
         * Enables or disables language support
         *
         * @param       $languageSupport        New language support setting
         * @return      void
         */
-       public final function enableLanguageSupport ($languageSupport = true) {
-               $this->languageSupport = (bool) $languageSupport;
+       public final function enableLanguageSupport (bool $languageSupport = true) {
+               $this->languageSupport = $languageSupport;
        }
 
        /**
@@ -1594,32 +1562,13 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
                return $this->languageSupport;
        }
 
-       /**
-        * Enables or disables XML compacting
-        *
-        * @param       $xmlCompacting  New XML compacting setting
-        * @return      void
-        */
-       public final function enableXmlCompacting ($xmlCompacting = true) {
-               $this->xmlCompacting = (bool) $xmlCompacting;
-       }
-
-       /**
-        * Checks whether XML compacting is enabled
-        *
-        * @return      $xmlCompacting  Whether XML compacting is enabled or disabled
-        */
-       public final function isXmlCompactingEnabled () {
-               return $this->xmlCompacting;
-       }
-
        /**
         * Removes all commentd, tabs and new-line characters to compact the content
         *
         * @param       $uncompactedContent             The uncompacted content
         * @return      $compactedContent               The compacted content
         */
-       public function compactContent ($uncompactedContent) {
+       public function compactContent (string $uncompactedContent) {
                // First, remove all tab/new-line/revert characters
                $compactedContent = str_replace(chr(9), '', str_replace(chr(10), '', str_replace(chr(13), '', $uncompactedContent)));
 
@@ -1632,8 +1581,8 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
                        foreach ($matches[0] as $match) {
                                // Remove the match
                                $compactedContent = str_replace($match, '', $compactedContent);
-                       } // END - foreach
-               } // END - if
+                       }
+               }
 
                // Set the content again
                $this->setRawTemplateData($compactedContent);