Continued:
authorRoland Häder <roland@mxchange.org>
Sun, 6 Dec 2020 11:24:23 +0000 (12:24 +0100)
committerRoland Häder <roland@mxchange.org>
Sun, 6 Dec 2020 11:24:23 +0000 (12:24 +0100)
- replaced InvalidObjectException with InvalidArgumentException
- that custom exception was already deprecated/unwanted anyway
- moved classes to deeper packages

Signed-off-by: Roland Häder <roland@mxchange.org>
18 files changed:
framework/main/classes/compressor/class_Bzip2Compressor.php
framework/main/classes/compressor/class_GzipCompressor.php
framework/main/classes/compressor/class_NullCompressor.php
framework/main/classes/compressor/class_ZlibCompressor.php
framework/main/classes/controller/class_BaseController.php
framework/main/classes/database/frontend/class_BaseDatabaseFrontend.php
framework/main/classes/decorator/template/class_XmlRewriterTemplateDecorator.php [deleted file]
framework/main/classes/decorator/xml/class_XmlCompactorDecorator.php [deleted file]
framework/main/classes/decorator/xml/compactor/class_XmlCompactorDecorator.php [new file with mode: 0644]
framework/main/classes/decorator/xml/template/class_XmlRewriterTemplateDecorator.php [new file with mode: 0644]
framework/main/classes/factories/class_BaseFactory.php
framework/main/classes/factories/database/class_DatabaseFrontendFactory.php
framework/main/classes/factories/html/class_HtmlNewsFactory.php
framework/main/classes/factories/index/class_FileStackIndexFactory.php
framework/main/classes/factories/objects/class_ObjectFactory.php
framework/main/classes/factories/xml/class_XmlTemplateEngineFactory.php
framework/main/exceptions/main/class_InvalidObjectException.php [deleted file]
framework/main/interfaces/compressor/class_Compressor.php

index 982b110da4ed452134660c36c4c6994f19257494..bdfe5d96ac9761051162d580480432d027960985 100644 (file)
@@ -6,6 +6,9 @@ namespace Org\Mxchange\CoreFramework\Compressor\Bzip2;
 use Org\Mxchange\CoreFramework\Compressor\Compressor;
 use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem;
 
+// Load SPL stuff
+use \InvalidArgumentException;
+
 /**
  * BZIP2 compression and decompression class
  *
@@ -52,7 +55,7 @@ class Bzip2Compressor extends BaseFrameworkSystem implements Compressor {
                if ((function_exists('bzcompress')) && (function_exists('bzdecompress'))) {
                        // Compressor can maybe be used
                        $compressorInstance = new Bzip2Compressor();
-               } // END - if
+               }
 
                // Return the compressor instance
                return $compressorInstance;
@@ -63,13 +66,14 @@ class Bzip2Compressor extends BaseFrameworkSystem implements Compressor {
         *
         * @param       $streamData             Mixed non-object stream data
         * @return      $streamData             The compressed stream data
-        * @throws      InvalidObjectException  If the stream is an object
+        * @throws      InvalidArgumentException        If the stream is not compressable or decompressable
         */
        public function compressStream ($streamData) {
-               if (is_object($streamData)) {
+               // Validate parameter
+               if (is_object($streamData) || is_resource($streamData)) {
                        // Throw an exception
-                       throw new InvalidObjectException($streamData, self::EXCEPTION_UNEXPECTED_OBJECT);
-               } // END - if
+                       throw new InvalidArgumentException(sprintf('streamData[]=%s cannot be compressed/decompressed', gettype($streamData)));
+               }
 
                // Return the compressed stream
                return bzcompress($streamData, 1);
@@ -80,13 +84,14 @@ class Bzip2Compressor extends BaseFrameworkSystem implements Compressor {
         *
         * @param       $streamData             Mixed non-object stream data
         * @return      $streamData             The decompressed stream data
-        * @throws      InvalidObjectException  If the stream is an object
+        * @throws      InvalidArgumentException        If the stream is not compressable or decompressable
         */
        public function decompressStream ($streamData) {
-               if (is_object($streamData)) {
+               // Validate parameter
+               if (is_object($streamData) || is_resource($streamData)) {
                        // Throw an exception
-                       throw new InvalidObjectException($streamData, self::EXCEPTION_UNEXPECTED_OBJECT);
-               } // END - if
+                       throw new InvalidArgumentException(sprintf('streamData[]=%s cannot be compressed/decompressed', gettype($streamData)));
+               }
 
                // Decompress it
                $streamData = bzdecompress($streamData, true);
index 36f556e28649cdff161ab8e2da008625e5989219..4a46ab89c950b8a86de5f93895e446ae2a61ac52 100644 (file)
@@ -6,6 +6,9 @@ namespace Org\Mxchange\CoreFramework\Compressor\Gzip;
 use Org\Mxchange\CoreFramework\Compressor\Compressor;
 use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem;
 
+// Load SPL stuff
+use \InvalidArgumentException;
+
 /**
  * GZIP compression and decompression class
  *
@@ -52,7 +55,7 @@ class GzipCompressor extends BaseFrameworkSystem implements Compressor {
                if ((function_exists('gzencode')) && (function_exists('gzdecode'))) {
                        // Compressor can maybe be used
                        $compressorInstance = new GzipCompressor();
-               } // END - if
+               }
 
                // Return the compressor instance
                return $compressorInstance;
@@ -63,13 +66,14 @@ class GzipCompressor extends BaseFrameworkSystem implements Compressor {
         *
         * @param       $streamData             Mixed non-object stream data
         * @return      $streamData             The compressed stream data
-        * @throws      InvalidObjectException  If the stream is an object
+        * @throws      InvalidArgumentException        If the stream is not compressable or decompressable
         */
        public function compressStream ($streamData) {
-               if (is_object($streamData)) {
+               // Validate parameter
+               if (is_object($streamData) || is_resource($streamData)) {
                        // Throw an exception
-                       throw new InvalidObjectException($streamData, self::EXCEPTION_UNEXPECTED_OBJECT);
-               } // END - if
+                       throw new InvalidArgumentException(sprintf('streamData[]=%s cannot be compressed/decompressed', gettype($streamData)));
+               }
 
                // Return the compressed stream
                return gzencode($streamData, 1);
@@ -80,13 +84,14 @@ class GzipCompressor extends BaseFrameworkSystem implements Compressor {
         *
         * @param       $streamData             Mixed non-object stream data
         * @return      $streamData             The decompressed stream data
-        * @throws      InvalidObjectException  If the stream is an object
+        * @throws      InvalidArgumentException        If the stream is not compressable or decompressable
         */
        public function decompressStream ($streamData) {
-               if (is_object($streamData)) {
+               // Validate parameter
+               if (is_object($streamData) || is_resource($streamData)) {
                        // Throw an exception
-                       throw new InvalidObjectException($streamData, self::EXCEPTION_UNEXPECTED_OBJECT);
-               } // END - if
+                       throw new InvalidArgumentException(sprintf('streamData[]=%s cannot be compressed/decompressed', gettype($streamData)));
+               }
 
                // Return the decompressed stream
                return gzdecode($streamData);
index a18a1a816d0c51d5e32c31f905f652fc9465f1b5..79e865dd95bc1ad031c6718d7f14a5d4084d76ff 100644 (file)
@@ -6,6 +6,9 @@ namespace Org\Mxchange\CoreFramework\Compressor\Null;
 use Org\Mxchange\CoreFramework\Compressor\Compressor;
 use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem;
 
+// Load SPL stuff
+use \InvalidArgumentException;
+
 /**
  * Null compression and decompression class
  *
@@ -57,13 +60,14 @@ class NullCompressor extends BaseFrameworkSystem implements Compressor {
         *
         * @param       $streamData             Mixed non-object stream data
         * @return      $streamData             The compressed stream data
-        * @throws      InvalidObjectException  If the stream is an object
+        * @throws      InvalidArgumentException        If the stream is not compressable or decompressable
         */
        public function compressStream ($streamData) {
-               if (is_object($streamData)) {
+               // Validate parameter
+               if (is_object($streamData) || is_resource($streamData)) {
                        // Throw an exception
-                       throw new InvalidObjectException($streamData, self::EXCEPTION_UNEXPECTED_OBJECT);
-               } // END - if
+                       throw new InvalidArgumentException(sprintf('streamData[]=%s cannot be compressed/decompressed', gettype($streamData)));
+               }
 
                // Return the compressed stream
                return $streamData;
@@ -74,13 +78,14 @@ class NullCompressor extends BaseFrameworkSystem implements Compressor {
         *
         * @param       $streamData             Mixed non-object stream data
         * @return      $streamData             The decompressed stream data
-        * @throws      InvalidObjectException  If the stream is an object
+        * @throws      InvalidArgumentException        If the stream is not compressable or decompressable
         */
        public function decompressStream ($streamData) {
-               if (is_object($streamData)) {
+               // Validate parameter
+               if (is_object($streamData) || is_resource($streamData)) {
                        // Throw an exception
-                       throw new InvalidObjectException($streamData, self::EXCEPTION_UNEXPECTED_OBJECT);
-               } // END - if
+                       throw new InvalidArgumentException(sprintf('streamData[]=%s cannot be compressed/decompressed', gettype($streamData)));
+               }
 
                // Return the decompressed stream
                return $streamData;
index 79b88d5d09dd2280e9b2561bad322efd9b6f3c44..6e120a47d6f2d32b6caadac8c3f93eb6604dfc14 100644 (file)
@@ -6,6 +6,9 @@ namespace Org\Mxchange\CoreFramework\Compressor\Zlib;
 use Org\Mxchange\CoreFramework\Compressor\Compressor;
 use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem;
 
+// Load SPL stuff
+use \InvalidArgumentException;
+
 /**
  * ZLIB compression and decompression class
  *
@@ -52,7 +55,7 @@ class ZlibCompressor extends BaseFrameworkSystem implements Compressor {
                if ((function_exists('gzcompress')) && (function_exists('gzuncompress'))) {
                        // Compressor can maybe be used
                        $compressorInstance = new ZlibCompressor();
-               } // END - if
+               }
 
                // Return the compressor instance
                return $compressorInstance;
@@ -63,13 +66,14 @@ class ZlibCompressor extends BaseFrameworkSystem implements Compressor {
         *
         * @param       $streamData             Mixed non-object stream data
         * @return      $streamData             The compressed stream data
-        * @throws      InvalidObjectException  If the stream is an object
+        * @throws      InvalidArgumentException        If the stream is not compressable or decompressable
         */
        public function compressStream ($streamData) {
-               if (is_object($streamData)) {
+               // Validate parameter
+               if (is_object($streamData) || is_resource($streamData)) {
                        // Throw an exception
-                       throw new InvalidObjectException($streamData, self::EXCEPTION_UNEXPECTED_OBJECT);
-               } // END - if
+                       throw new InvalidArgumentException(sprintf('streamData[]=%s cannot be compressed/decompressed', gettype($streamData)));
+               }
 
                // Return the compressed stream
                return gzcompress($streamData, 1);
@@ -80,13 +84,14 @@ class ZlibCompressor extends BaseFrameworkSystem implements Compressor {
         *
         * @param       $streamData             Mixed non-object stream data
         * @return      $streamData             The decompressed stream data
-        * @throws      InvalidObjectException  If the stream is an object
+        * @throws      InvalidArgumentException        If the stream is not compressable or decompressable
         */
        public function decompressStream ($streamData) {
-               if (is_object($streamData)) {
+               // Validate parameter
+               if (is_object($streamData) || is_resource($streamData)) {
                        // Throw an exception
-                       throw new InvalidObjectException($streamData, self::EXCEPTION_UNEXPECTED_OBJECT);
-               } // END - if
+                       throw new InvalidArgumentException(sprintf('streamData[]=%s cannot be compressed/decompressed', gettype($streamData)));
+               }
 
                // Return the decompressed stream
                return gzuncompress($streamData);
index 56c0e214a4929041230a07e7c70ffc069b84d11e..7c2acb44e16631da5dfc4b2097226d72d67149d8 100644 (file)
@@ -193,7 +193,7 @@ abstract class BaseController extends BaseFrameworkSystem implements Registerabl
         * @param       $filterChain    Name of the filter chain
         * @return      void
         */
-       protected function initFilterChain ($filterChain) {
+       protected function initFilterChain (string $filterChain) {
                //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CONTROLLER: ' . $filterChain . ' init: START');
                $this->filterChains[$filterChain] = ObjectFactory::createObjectByConfiguredName('filter_chain_class');
                //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CONTROLLER: ' . $filterChain . ' init: FINISHED');
@@ -207,7 +207,7 @@ abstract class BaseController extends BaseFrameworkSystem implements Registerabl
         * @return      void
         * @throws      InvalidFilterChainException     If the filter chain is invalid
         */
-       protected function addFilter ($filterChain, Filterable $filterInstance) {
+       protected function addFilter (string $filterChain, Filterable $filterInstance) {
                //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CONTROLLER: ' . $filterChain . ',' . $filterInstance->__toString(). ' add: START');
 
                // Test if the filter is there
@@ -262,7 +262,7 @@ abstract class BaseController extends BaseFrameworkSystem implements Registerabl
         * @return      void
         * @throws      InvalidFilterChainException     If the filter chain is invalid
         */
-       protected function executeFilters ($filterChain, Requestable $requestInstance, Responseable $responseInstance) {
+       protected function executeFilters (string $filterChain, Requestable $requestInstance, Responseable $responseInstance) {
                // Test if the filter is there
                if (!isset($this->filterChains[$filterChain])) {
                        // Throw an exception here
index 446e13a51ff789b5d01ffaf86fc2d07f5c9a18d0..1201949f9ad24ba3ce514c5e400ab1ad82a3a54b 100644 (file)
@@ -45,11 +45,12 @@ abstract class BaseDatabaseFrontend extends BaseFrameworkSystem {
        /**
         * Protected constructor
         *
+        * @param       $className      Name of the class
         * @return      void
         */
-       protected function __construct ($class) {
+       protected function __construct (string $className) {
                // Call parent constructor
-               parent::__construct($class);
+               parent::__construct($className);
 
                // Initialize the cache instance
                $this->initCacheInstance();
diff --git a/framework/main/classes/decorator/template/class_XmlRewriterTemplateDecorator.php b/framework/main/classes/decorator/template/class_XmlRewriterTemplateDecorator.php
deleted file mode 100644 (file)
index b119daa..0000000
+++ /dev/null
@@ -1,453 +0,0 @@
-<?php
-// Own namespace
-namespace Org\Mxchange\CoreFramework\Template\Xml;
-
-// Import framework stuff
-use Org\Mxchange\CoreFramework\Generic\BaseDecorator;
-use Org\Mxchange\CoreFramework\Response\Responseable;
-use Org\Mxchange\CoreFramework\Template\Xml\CompileableXmlTemplate;
-use Org\Mxchange\CoreFramework\Traits\Template\CompileableTemplateTrait;
-
-/**
- * A decorator for XML template engines which rewrites the XML for compacting
- * it.
- *
- * @author             Roland Haeder <webmaster@shipsimu.org>
- * @version            0.0.0
- * @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
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-class XmlRewriterTemplateDecorator extends BaseDecorator implements CompileableXmlTemplate {
-       // Load traits
-       use CompileableTemplateTrait;
-
-       /**
-        * Protected constructor
-        *
-        * @return      void
-        */
-       protected function __construct () {
-               // Call parent constructor
-               parent::__construct(__CLASS__);
-       }
-
-       /**
-        * Creates an instance of the class TemplateEngine and prepares it for usage
-        *
-        * @param       $innerTemplateInstance  A CompileableXmlTemplate instance
-        * @return      $templateInstance       An instance of TemplateEngine
-        */
-       public static final function createXmlRewriterTemplateDecorator (CompileableXmlTemplate $innerTemplateInstance) {
-               // Get a new instance
-               $templateInstance = new XmlRewriterTemplateDecorator();
-
-               // Set the inner template engine
-               $templateInstance->setTemplateInstance($innerTemplateInstance);
-
-               // Return the prepared instance
-               return $templateInstance;
-       }
-
-       /**
-        * Settter for variable group
-        *
-        * @param       $groupName      Name of variable group
-        * @param       $add            Whether add this group
-        * @return      void
-        */
-       public function setVariableGroup (string $groupName, bool $add = true) {
-               // Call the inner class' method
-               $this->getTemplateInstance()->setVariableGroup($groupName, $add);
-       }
-
-       /**
-        * Adds a variable to current group
-        *
-        * @param       $variableName   Variable to set
-        * @param       $value  Value to store in variable
-        * @return      void
-        */
-       public function addGroupVariable (string $variableName, $value) {
-               // Call the inner class' method
-               $this->getTemplateInstance()->addGroupVariable($variableName, $value);
-       }
-
-       /**
-        * Getter for base path
-        *
-        * @return      $templateBasePath       The relative base path for all templates
-        */
-       public final function getTemplateBasePath () {
-               // Call the inner class' method
-               return $this->getTemplateInstance()->getTemplateBasePath();
-       }
-
-       /**
-        * Getter for generic base path
-        *
-        * @return      $templateBasePath       The relative base path for all templates
-        */
-       public final function getGenericBasePath () {
-               // Call the inner class' method
-               return $this->getTemplateInstance()->getGenericBasePath();
-       }
-
-       /**
-        * Getter for template extension
-        *
-        * @return      $templateExtension      The file extension for all uncompiled templates
-        */
-       public final function getRawTemplateExtension () {
-               // Call the inner class' method
-               return $this->getTemplateInstance()->getRawTemplateExtension();
-       }
-
-       /**
-        * Getter for given variable group
-        *
-        * @param       $variableGroup  Variable group to check
-        * @return      $varStack               Found variable group
-        */
-       public function getVarStack (string $variableGroup) {
-               // Call the inner class' method
-               return $this->getTemplateInstance()->getVarStack($variableGroup);
-       }
-
-       /**
-        * Getter for code-template extension
-        *
-        * @return      $codeExtension  The file extension for all code templates
-        */
-       public final function getCodeTemplateExtension () {
-               // Call the inner class' method
-               return $this->getTemplateInstance()->getCodeTemplateExtension();
-       }
-
-       /**
-        * Getter for template type
-        *
-        * @return      $templateType   The current template's type
-        */
-       public final function getTemplateType () {
-               // Call the inner class' method
-               return $this->getTemplateInstance()->getTemplateType();
-       }
-
-       /**
-        * 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
-        */
-       public function assignVariable (string $variableName, $value) {
-               // Call the inner class' method
-               $this->getTemplateInstance()->assignVariable($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 function removeVariable (string $variableName, string $variableGroup = 'general') {
-               // Call the inner class' method
-               $this->getTemplateInstance()->removeVariable($variableName, $variableGroup);
-       }
-
-       /**
-        * Load a specified HTML template into the engine
-        *
-        * @param       $template       The web template we shall load which is located in
-        *                                              'html' by default
-        * @return      void
-        */
-       public function loadHtmlTemplate (string $template) {
-               // Call the inner class' method
-               $this->getTemplateInstance()->loadHtmlTemplate($template);
-       }
-
-       /**
-        * Assign a given congfiguration variable with a value
-        *
-        * @param       $variableName   The configuration variable we want to assign
-        * @return      void
-        */
-       public function assignConfigVariable (string $variableName) {
-               // Call the inner class' method
-               $this->getTemplateInstance()->assignConfigVariable($variableName);
-       }
-
-       /**
-        * Load a specified code template into the engine
-        *
-        * @param       $template       The code template we shall load which is
-        *                                              located in 'code' by default
-        * @return      void
-        */
-       public function loadCodeTemplate (string $template) {
-               // Call the inner class' method
-               $this->getTemplateInstance()->loadCodeTemplate($template);
-       }
-
-       /**
-        * Load a specified email template into the engine for later compilation
-        * with other code/web/email templates.
-        *
-        * @param       $template       The email template we shall load which is
-        *                                              located in "html" by default
-        * @return      void
-        */
-       public function loadEmailTemplate ($template) {
-               // Call the inner class' method
-               $this->getTemplateInstance()->loadEmailTemplate($template);
-       }
-
-       /**
-        * Compiles configuration place-holders in all variables. This 'walks'
-        * through the variable stack 'general'. It interprets all values from that
-        * variables as configuration entries after compiling them.
-        *
-        * @return      void
-        */
-       public function compileConfigInVariables () {
-               // Call the inner class' method
-               $this->getTemplateInstance()->compileConfigInVariables();
-       }
-
-       /**
-        * Compile all variables by inserting their respective values
-        *
-        * @return      void
-        */
-       public function compileVariables () {
-               // Call the inner class' method
-               $this->getTemplateInstance()->compileVariables();
-       }
-
-       /**
-        * Compile all required templates into the current loaded one
-        *
-        * @return      void
-        */
-       public function compileTemplate () {
-               // Call the inner class' method
-               $this->getTemplateInstance()->compileTemplate();
-       }
-
-       /**
-        * 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 (string $templateName, string $variableName) {
-               // Call the inner class' method
-               $this->getTemplateInstance()->assignTemplateWithVariable($templateName, $variableName);
-       }
-
-       /**
-        * Transfers the content of this template engine to a given response instance
-        *
-        * @param       $responseInstance       An instance of a Responseable class
-        * @return      void
-        */
-       public function transferToResponse (Responseable $responseInstance) {
-               // Call the inner class' method
-               $this->getTemplateInstance()->transportToResponse($responseInstance);
-       }
-
-       /**
-        * Assigns all the application data with template variables
-        *
-        * @return      void
-        */
-       public function assignApplicationData () {
-               // Call the inner class' method
-               $this->getTemplateInstance()->assignApplicationData();
-       }
-
-       /**
-        * "Compiles" a variable by replacing {?var?} with it's content
-        *
-        * @param       $rawCode                        Raw code to compile
-        * @param       $setMatchAsCode         Sets $match if readVariable() returns empty result
-        * @return      $rawCode                        Compile code with inserted variable value
-        */
-       public function compileRawCode (string $rawCode, bool $setMatchAsCode = false) {
-               return $this->getTemplateInstance()->compileRawCode($rawCode, $setMatchAsCode);
-       }
-
-       /**
-        * Getter for variable group array
-        *
-        * @return      $variableGroups         All variable groups
-        */
-       public final function getVariableGroups () {
-               // Call the inner class' method
-               return $this->getTemplateInstance()->getVariableGroups();
-       }
-
-       /**
-        * Getter for raw template data
-        *
-        * @return      $rawTemplateData        The raw data from the template
-        */
-       public function getRawTemplateData () {
-               // Call the inner class' method
-               return $this->getTemplateInstance()->getRawTemplateData();
-       }
-
-       /**
-        * Renames a variable in code and in stack
-        *
-        * @param       $oldName        Old name of variable
-        * @param       $newName        New name of variable
-        * @return      void
-        */
-       public function renameVariable (string $oldName, string $newName) {
-               // Call the inner class' method
-               $this->getTemplateInstance()->renameVariable($oldName, $newName);
-       }
-
-       /**
-        * 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 (string $content = NULL) {
-               // Call the inner class' method
-               $this->getTemplateInstance()->renderXmlContent($content);
-       }
-
-       /**
-        * Enables or disables language support
-        *
-        * @param       $languageSupport        New language support setting
-        * @return      void
-        */
-       public function enableLanguageSupport (bool $languageSupport = true) {
-               // Call the inner class' method
-               $this->getTemplateInstance()->enableLanguageSupport($languageSupport);
-       }
-
-       /**
-        * Checks whether language support is enabled
-        *
-        * @return      $languageSupport        Whether language support is enabled or disabled
-        */
-       public function isLanguageSupportEnabled () {
-               // Call the inner class' method
-               return $this->getTemplateInstance()->isLanguageSupportEnabled();
-       }
-
-       /**
-        * Enables or disables XML compacting
-        *
-        * @param       $xmlCompacting  New XML compacting setting
-        * @return      void
-        */
-       public function enableXmlCompacting (bool $xmlCompacting = true) {
-               // Call the inner class' method
-               $this->getTemplateInstance()->enableXmlCompacting($xmlCompacting);
-       }
-
-       /**
-        * Checks whether XML compacting is enabled
-        *
-        * @return      $xmlCompacting  Whether XML compacting is enabled or disabled
-        */
-       public function isXmlCompactingEnabled () {
-               // Call the inner class' method
-               return $this->getTemplateInstance()->isXmlCompactingEnabled();
-       }
-
-       /**
-        * Handles the start element of an XML resource
-        *
-        * @param       $resource               XML parser resource (currently ignored)
-        * @param       $element                The element we shall handle
-        * @param       $attributes             All attributes
-        * @return      void
-        * @throws      InvalidXmlNodeException         If an unknown/invalid XML node name was found
-        */
-       public function startElement ($resource, string $element, array $attributes) {
-               // Call the inner class' method
-               $this->getTemplateInstance()->startElement($resource, $element, $attributes);
-       }
-
-       /**
-        * Ends the main or sub node by sending out the gathered data
-        *
-        * @param       $resource       An XML resource pointer (currently ignored)
-        * @param       $nodeName       Name of the node we want to finish
-        * @return      void
-        * @throws      XmlNodeMismatchException        If current main node mismatches the closing one
-        */
-       public function finishElement ($resource, string $nodeName) {
-               // Call the inner class' method
-               $this->getTemplateInstance()->finishElement($resource, $nodeName);
-       }
-
-       /**
-        * Currently not used
-        *
-        * @param       $resource               XML parser resource (currently ignored)
-        * @param       $characters             Characters to handle
-        * @return      void
-        * @todo        Find something useful with this!
-        */
-       public function characterHandler ($resource, string $characters) {
-               // Call the inner class' method but trim the characters before
-               $this->getTemplateInstance()->characterHandler($resource, trim($characters));
-       }
-
-       /**
-        * Removes all comments, tabs and new-line charcters to compact the content
-        *
-        * @param       $uncompactedContent             The uncompacted content
-        * @return      $compactedContent               The compacted content
-        */
-       public function compactContent (string $uncompactedContent) {
-               // Compact it ...
-               $compactedContent = $this->getTemplateInstance()->compactContent($uncompactedContent);
-
-               // ... and return it
-               return $compactedContent;
-       }
-
-       /**
-        * Assigns a lot variables into the stack of currently loaded template.
-        * This method should only be used in very rare circumstances, e.g. when
-        * you have to copy a whole set of variables into the template engine.
-        * Before you use this method, please make sure you have considered all
-        * other possiblities.
-        *
-        * @param       $variables      An array with variables to be assigned
-        * @return      void
-        */
-       public function assignMultipleVariables (array $variables) {
-               // Call the inner class' method but trim the characters before
-               $this->getTemplateInstance()->assignMultipleVariables($variables);
-       }
-
-}
diff --git a/framework/main/classes/decorator/xml/class_XmlCompactorDecorator.php b/framework/main/classes/decorator/xml/class_XmlCompactorDecorator.php
deleted file mode 100644 (file)
index db9cfce..0000000
+++ /dev/null
@@ -1,105 +0,0 @@
-<?php
-// Own namespace
-namespace Org\Mxchange\CoreFramework\Parser\Xml;
-
-// Import framework stuff
-use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
-use Org\Mxchange\CoreFramework\Generic\BaseDecorator;
-use Org\Mxchange\CoreFramework\Parser\Parseable;
-
-/**
- * A XML compacting decorator class for XML parsers
- *
- * @author             Roland Haeder <webmaster@shipsimu.org>
- * @version            0.0.0
- * @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
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-class XmlCompactorDecorator extends BaseDecorator implements Parseable {
-       /**
-        * Instance of the parser class
-        */
-       private $parserInstance = NULL;
-
-       /**
-        * Protected constructor
-        *
-        * @return      void
-        */
-       protected function __construct () {
-               // Call parent constructor
-               parent::__construct(__CLASS__);
-       }
-
-       /**
-        * Creates an instance of the class Parser and prepares it for usage
-        *
-        * @param       $innerParserInstance    A Parseable instance
-        * @return      $parserInstance         An instance of this parser
-        */
-       public static final function createXmlCompactorDecorator (Parseable $innerParserInstance) {
-               // Get a new instance
-               $parserInstance = new XmlCompactorDecorator();
-
-               // Get a new decorator instance for the template engine
-               $templateInstance = ObjectFactory::createObjectByConfiguredName('deco_xml_rewriter_template_class', array($innerParserInstance->getTemplateInstance()));
-
-               // Re-set the parser's template instance to the decorator instance
-               $innerParserInstance->setTemplateInstance($templateInstance);
-
-               // Set the inner parser instance
-               $parserInstance->setParserInstance($innerParserInstance);
-
-               // Return the prepared instance
-               return $parserInstance;
-       }
-
-       /**
-        * Setter for Parseable instance
-        *
-        * @param       $parserInstance An instance of an Parseable
-        * @return      void
-        */
-       protected final function setParserInstance (Parseable $parserInstance) {
-               $this->parserInstance = $parserInstance;
-       }
-
-       /**
-        * Getter for Parseable instance
-        *
-        * @return      $parserInstance An instance of an Parseable
-        */
-       private final function getParserInstance () {
-               return $this->parserInstance;
-       }
-
-       /**
-        * Parses the given XML content
-        *
-        * @param       $content        Valid XML content
-        * @return      void
-        * @throws      XmlCompactorDecoratorException  If an XML error was found
-        */
-       public function parseXmlContent ($content) {
-               // Remove all comments for better compacting
-               $content = $this->getParserInstance()->getTemplateInstance()->compactContent($content);
-
-               // Parse the content
-               $this->getParserInstance()->parseXmlContent($content);
-       }
-
-}
diff --git a/framework/main/classes/decorator/xml/compactor/class_XmlCompactorDecorator.php b/framework/main/classes/decorator/xml/compactor/class_XmlCompactorDecorator.php
new file mode 100644 (file)
index 0000000..23c125b
--- /dev/null
@@ -0,0 +1,105 @@
+<?php
+// Own namespace
+namespace Org\Mxchange\CoreFramework\Parser\Xml;
+
+// Import framework stuff
+use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
+use Org\Mxchange\CoreFramework\Generic\BaseDecorator;
+use Org\Mxchange\CoreFramework\Parser\Parseable;
+
+/**
+ * A XML compacting decorator class for XML parsers
+ *
+ * @author             Roland Haeder <webmaster@shipsimu.org>
+ * @version            0.0.0
+ * @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
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class XmlCompactorDecorator extends BaseDecorator implements Parseable {
+       /**
+        * Instance of the parser class
+        */
+       private $parserInstance = NULL;
+
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+       }
+
+       /**
+        * Creates an instance of the class Parser and prepares it for usage
+        *
+        * @param       $innerParserInstance    A Parseable instance
+        * @return      $parserInstance         An instance of this parser
+        */
+       public static final function createXmlCompactorDecorator (Parseable $innerParserInstance) {
+               // Get a new instance
+               $parserInstance = new XmlCompactorDecorator();
+
+               // Get a new decorator instance for the template engine
+               $templateInstance = ObjectFactory::createObjectByConfiguredName('deco_xml_rewriter_template_class', array($innerParserInstance->getTemplateInstance()));
+
+               // Re-set the parser's template instance to the decorator instance
+               $innerParserInstance->setTemplateInstance($templateInstance);
+
+               // Set the inner parser instance
+               $parserInstance->setParserInstance($innerParserInstance);
+
+               // Return the prepared instance
+               return $parserInstance;
+       }
+
+       /**
+        * Setter for Parseable instance
+        *
+        * @param       $parserInstance An instance of an Parseable
+        * @return      void
+        */
+       protected final function setParserInstance (Parseable $parserInstance) {
+               $this->parserInstance = $parserInstance;
+       }
+
+       /**
+        * Getter for Parseable instance
+        *
+        * @return      $parserInstance An instance of an Parseable
+        */
+       private final function getParserInstance () {
+               return $this->parserInstance;
+       }
+
+       /**
+        * Parses the given XML content
+        *
+        * @param       $content        Valid XML content
+        * @return      void
+        * @throws      XmlCompactorDecoratorException  If an XML error was found
+        */
+       public function parseXmlContent (string $content) {
+               // Remove all comments for better compacting
+               $content = $this->getParserInstance()->getTemplateInstance()->compactContent($content);
+
+               // Parse the content
+               $this->getParserInstance()->parseXmlContent($content);
+       }
+
+}
diff --git a/framework/main/classes/decorator/xml/template/class_XmlRewriterTemplateDecorator.php b/framework/main/classes/decorator/xml/template/class_XmlRewriterTemplateDecorator.php
new file mode 100644 (file)
index 0000000..b119daa
--- /dev/null
@@ -0,0 +1,453 @@
+<?php
+// Own namespace
+namespace Org\Mxchange\CoreFramework\Template\Xml;
+
+// Import framework stuff
+use Org\Mxchange\CoreFramework\Generic\BaseDecorator;
+use Org\Mxchange\CoreFramework\Response\Responseable;
+use Org\Mxchange\CoreFramework\Template\Xml\CompileableXmlTemplate;
+use Org\Mxchange\CoreFramework\Traits\Template\CompileableTemplateTrait;
+
+/**
+ * A decorator for XML template engines which rewrites the XML for compacting
+ * it.
+ *
+ * @author             Roland Haeder <webmaster@shipsimu.org>
+ * @version            0.0.0
+ * @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
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class XmlRewriterTemplateDecorator extends BaseDecorator implements CompileableXmlTemplate {
+       // Load traits
+       use CompileableTemplateTrait;
+
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+       }
+
+       /**
+        * Creates an instance of the class TemplateEngine and prepares it for usage
+        *
+        * @param       $innerTemplateInstance  A CompileableXmlTemplate instance
+        * @return      $templateInstance       An instance of TemplateEngine
+        */
+       public static final function createXmlRewriterTemplateDecorator (CompileableXmlTemplate $innerTemplateInstance) {
+               // Get a new instance
+               $templateInstance = new XmlRewriterTemplateDecorator();
+
+               // Set the inner template engine
+               $templateInstance->setTemplateInstance($innerTemplateInstance);
+
+               // Return the prepared instance
+               return $templateInstance;
+       }
+
+       /**
+        * Settter for variable group
+        *
+        * @param       $groupName      Name of variable group
+        * @param       $add            Whether add this group
+        * @return      void
+        */
+       public function setVariableGroup (string $groupName, bool $add = true) {
+               // Call the inner class' method
+               $this->getTemplateInstance()->setVariableGroup($groupName, $add);
+       }
+
+       /**
+        * Adds a variable to current group
+        *
+        * @param       $variableName   Variable to set
+        * @param       $value  Value to store in variable
+        * @return      void
+        */
+       public function addGroupVariable (string $variableName, $value) {
+               // Call the inner class' method
+               $this->getTemplateInstance()->addGroupVariable($variableName, $value);
+       }
+
+       /**
+        * Getter for base path
+        *
+        * @return      $templateBasePath       The relative base path for all templates
+        */
+       public final function getTemplateBasePath () {
+               // Call the inner class' method
+               return $this->getTemplateInstance()->getTemplateBasePath();
+       }
+
+       /**
+        * Getter for generic base path
+        *
+        * @return      $templateBasePath       The relative base path for all templates
+        */
+       public final function getGenericBasePath () {
+               // Call the inner class' method
+               return $this->getTemplateInstance()->getGenericBasePath();
+       }
+
+       /**
+        * Getter for template extension
+        *
+        * @return      $templateExtension      The file extension for all uncompiled templates
+        */
+       public final function getRawTemplateExtension () {
+               // Call the inner class' method
+               return $this->getTemplateInstance()->getRawTemplateExtension();
+       }
+
+       /**
+        * Getter for given variable group
+        *
+        * @param       $variableGroup  Variable group to check
+        * @return      $varStack               Found variable group
+        */
+       public function getVarStack (string $variableGroup) {
+               // Call the inner class' method
+               return $this->getTemplateInstance()->getVarStack($variableGroup);
+       }
+
+       /**
+        * Getter for code-template extension
+        *
+        * @return      $codeExtension  The file extension for all code templates
+        */
+       public final function getCodeTemplateExtension () {
+               // Call the inner class' method
+               return $this->getTemplateInstance()->getCodeTemplateExtension();
+       }
+
+       /**
+        * Getter for template type
+        *
+        * @return      $templateType   The current template's type
+        */
+       public final function getTemplateType () {
+               // Call the inner class' method
+               return $this->getTemplateInstance()->getTemplateType();
+       }
+
+       /**
+        * 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
+        */
+       public function assignVariable (string $variableName, $value) {
+               // Call the inner class' method
+               $this->getTemplateInstance()->assignVariable($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 function removeVariable (string $variableName, string $variableGroup = 'general') {
+               // Call the inner class' method
+               $this->getTemplateInstance()->removeVariable($variableName, $variableGroup);
+       }
+
+       /**
+        * Load a specified HTML template into the engine
+        *
+        * @param       $template       The web template we shall load which is located in
+        *                                              'html' by default
+        * @return      void
+        */
+       public function loadHtmlTemplate (string $template) {
+               // Call the inner class' method
+               $this->getTemplateInstance()->loadHtmlTemplate($template);
+       }
+
+       /**
+        * Assign a given congfiguration variable with a value
+        *
+        * @param       $variableName   The configuration variable we want to assign
+        * @return      void
+        */
+       public function assignConfigVariable (string $variableName) {
+               // Call the inner class' method
+               $this->getTemplateInstance()->assignConfigVariable($variableName);
+       }
+
+       /**
+        * Load a specified code template into the engine
+        *
+        * @param       $template       The code template we shall load which is
+        *                                              located in 'code' by default
+        * @return      void
+        */
+       public function loadCodeTemplate (string $template) {
+               // Call the inner class' method
+               $this->getTemplateInstance()->loadCodeTemplate($template);
+       }
+
+       /**
+        * Load a specified email template into the engine for later compilation
+        * with other code/web/email templates.
+        *
+        * @param       $template       The email template we shall load which is
+        *                                              located in "html" by default
+        * @return      void
+        */
+       public function loadEmailTemplate ($template) {
+               // Call the inner class' method
+               $this->getTemplateInstance()->loadEmailTemplate($template);
+       }
+
+       /**
+        * Compiles configuration place-holders in all variables. This 'walks'
+        * through the variable stack 'general'. It interprets all values from that
+        * variables as configuration entries after compiling them.
+        *
+        * @return      void
+        */
+       public function compileConfigInVariables () {
+               // Call the inner class' method
+               $this->getTemplateInstance()->compileConfigInVariables();
+       }
+
+       /**
+        * Compile all variables by inserting their respective values
+        *
+        * @return      void
+        */
+       public function compileVariables () {
+               // Call the inner class' method
+               $this->getTemplateInstance()->compileVariables();
+       }
+
+       /**
+        * Compile all required templates into the current loaded one
+        *
+        * @return      void
+        */
+       public function compileTemplate () {
+               // Call the inner class' method
+               $this->getTemplateInstance()->compileTemplate();
+       }
+
+       /**
+        * 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 (string $templateName, string $variableName) {
+               // Call the inner class' method
+               $this->getTemplateInstance()->assignTemplateWithVariable($templateName, $variableName);
+       }
+
+       /**
+        * Transfers the content of this template engine to a given response instance
+        *
+        * @param       $responseInstance       An instance of a Responseable class
+        * @return      void
+        */
+       public function transferToResponse (Responseable $responseInstance) {
+               // Call the inner class' method
+               $this->getTemplateInstance()->transportToResponse($responseInstance);
+       }
+
+       /**
+        * Assigns all the application data with template variables
+        *
+        * @return      void
+        */
+       public function assignApplicationData () {
+               // Call the inner class' method
+               $this->getTemplateInstance()->assignApplicationData();
+       }
+
+       /**
+        * "Compiles" a variable by replacing {?var?} with it's content
+        *
+        * @param       $rawCode                        Raw code to compile
+        * @param       $setMatchAsCode         Sets $match if readVariable() returns empty result
+        * @return      $rawCode                        Compile code with inserted variable value
+        */
+       public function compileRawCode (string $rawCode, bool $setMatchAsCode = false) {
+               return $this->getTemplateInstance()->compileRawCode($rawCode, $setMatchAsCode);
+       }
+
+       /**
+        * Getter for variable group array
+        *
+        * @return      $variableGroups         All variable groups
+        */
+       public final function getVariableGroups () {
+               // Call the inner class' method
+               return $this->getTemplateInstance()->getVariableGroups();
+       }
+
+       /**
+        * Getter for raw template data
+        *
+        * @return      $rawTemplateData        The raw data from the template
+        */
+       public function getRawTemplateData () {
+               // Call the inner class' method
+               return $this->getTemplateInstance()->getRawTemplateData();
+       }
+
+       /**
+        * Renames a variable in code and in stack
+        *
+        * @param       $oldName        Old name of variable
+        * @param       $newName        New name of variable
+        * @return      void
+        */
+       public function renameVariable (string $oldName, string $newName) {
+               // Call the inner class' method
+               $this->getTemplateInstance()->renameVariable($oldName, $newName);
+       }
+
+       /**
+        * 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 (string $content = NULL) {
+               // Call the inner class' method
+               $this->getTemplateInstance()->renderXmlContent($content);
+       }
+
+       /**
+        * Enables or disables language support
+        *
+        * @param       $languageSupport        New language support setting
+        * @return      void
+        */
+       public function enableLanguageSupport (bool $languageSupport = true) {
+               // Call the inner class' method
+               $this->getTemplateInstance()->enableLanguageSupport($languageSupport);
+       }
+
+       /**
+        * Checks whether language support is enabled
+        *
+        * @return      $languageSupport        Whether language support is enabled or disabled
+        */
+       public function isLanguageSupportEnabled () {
+               // Call the inner class' method
+               return $this->getTemplateInstance()->isLanguageSupportEnabled();
+       }
+
+       /**
+        * Enables or disables XML compacting
+        *
+        * @param       $xmlCompacting  New XML compacting setting
+        * @return      void
+        */
+       public function enableXmlCompacting (bool $xmlCompacting = true) {
+               // Call the inner class' method
+               $this->getTemplateInstance()->enableXmlCompacting($xmlCompacting);
+       }
+
+       /**
+        * Checks whether XML compacting is enabled
+        *
+        * @return      $xmlCompacting  Whether XML compacting is enabled or disabled
+        */
+       public function isXmlCompactingEnabled () {
+               // Call the inner class' method
+               return $this->getTemplateInstance()->isXmlCompactingEnabled();
+       }
+
+       /**
+        * Handles the start element of an XML resource
+        *
+        * @param       $resource               XML parser resource (currently ignored)
+        * @param       $element                The element we shall handle
+        * @param       $attributes             All attributes
+        * @return      void
+        * @throws      InvalidXmlNodeException         If an unknown/invalid XML node name was found
+        */
+       public function startElement ($resource, string $element, array $attributes) {
+               // Call the inner class' method
+               $this->getTemplateInstance()->startElement($resource, $element, $attributes);
+       }
+
+       /**
+        * Ends the main or sub node by sending out the gathered data
+        *
+        * @param       $resource       An XML resource pointer (currently ignored)
+        * @param       $nodeName       Name of the node we want to finish
+        * @return      void
+        * @throws      XmlNodeMismatchException        If current main node mismatches the closing one
+        */
+       public function finishElement ($resource, string $nodeName) {
+               // Call the inner class' method
+               $this->getTemplateInstance()->finishElement($resource, $nodeName);
+       }
+
+       /**
+        * Currently not used
+        *
+        * @param       $resource               XML parser resource (currently ignored)
+        * @param       $characters             Characters to handle
+        * @return      void
+        * @todo        Find something useful with this!
+        */
+       public function characterHandler ($resource, string $characters) {
+               // Call the inner class' method but trim the characters before
+               $this->getTemplateInstance()->characterHandler($resource, trim($characters));
+       }
+
+       /**
+        * Removes all comments, tabs and new-line charcters to compact the content
+        *
+        * @param       $uncompactedContent             The uncompacted content
+        * @return      $compactedContent               The compacted content
+        */
+       public function compactContent (string $uncompactedContent) {
+               // Compact it ...
+               $compactedContent = $this->getTemplateInstance()->compactContent($uncompactedContent);
+
+               // ... and return it
+               return $compactedContent;
+       }
+
+       /**
+        * Assigns a lot variables into the stack of currently loaded template.
+        * This method should only be used in very rare circumstances, e.g. when
+        * you have to copy a whole set of variables into the template engine.
+        * Before you use this method, please make sure you have considered all
+        * other possiblities.
+        *
+        * @param       $variables      An array with variables to be assigned
+        * @return      void
+        */
+       public function assignMultipleVariables (array $variables) {
+               // Call the inner class' method but trim the characters before
+               $this->getTemplateInstance()->assignMultipleVariables($variables);
+       }
+
+}
index 1eea9ce9ae14c970f79831f58813c62e631e5c4f..5b16ef500c963df9286d3cad54af59073ba95068 100644 (file)
@@ -41,12 +41,12 @@ abstract class BaseFactory extends BaseFrameworkSystem {
        /**
         * Protected constructor
         *
-        * @param       $fullClassName  Name of the real class (not BaseFactory)
+        * @param       $className      Name of the real class (not BaseFactory)
         * @return      void
         */
-       protected function __construct ($fullClassName) {
+       protected function __construct (string $className) {
                // Call parent constructor
-               parent::__construct($fullClassName);
+               parent::__construct($className);
        }
 
        /**
@@ -54,15 +54,15 @@ abstract class BaseFactory extends BaseFrameworkSystem {
         *
         * @param       $fullClassName  Name of the class we shall count
         */
-       protected static final function countObject ($fullClassName) {
+       protected static final function countObject (string $fullClassName) {
                // Count it up in total sum
                self::$total++;
 
                // Do we have an entry?
-               if (!isset(self::$objectCounters[$fullClassName])) {
+               if (!self::isClassCounted($fullClassName)) {
                        // No, then generate one
                        self::$objectCounters[$fullClassName] = 0;
-               } // END - if
+               }
 
                // Count it up again
                //* NOISY-DEBUG: */ print __METHOD__.': className=' .$fullClassName . PHP_EOL;
@@ -87,4 +87,15 @@ abstract class BaseFactory extends BaseFrameworkSystem {
                return self::$objectCounters;
        }
 
+       /**
+        * Checks whether given full class name is already counted
+        *
+        * @param       $fullClassName  Full name of class
+        * @return      $isCounted      Whether given class name is counted
+        */
+       protected static final function isClassCounted (string $fullClassName) {
+               // Return isset() result
+               return isset(self::$objectCounters[$fullClassName]);
+       }
+
 }
index 8df8c28580306a034633c73eedc5254c33861fc2..6848cf360b565634190a9305ed175a004faf21fc 100644 (file)
@@ -46,7 +46,7 @@ class DatabaseFrontendFactory extends ObjectFactory {
         *
         * @return      $frontendInstance       A database frontend instance
         */
-       public static final function createFrontendByConfiguredName ($frontendName) {
+       public static final function createFrontendByConfiguredName (string $frontendName) {
                // Get registry instance
                $registryInstance = GenericRegistry::getRegistry();
 
index da522134ef2a620be0cf5164184ea5e5c232af35..ebcd9ff46149b7055d217e0c561d9b94894997c8 100644 (file)
@@ -67,8 +67,8 @@ class HtmlNewsFactory extends BaseFactory {
                        if (!empty($action)) {
                                // Then use both for config entry
                                $configEntry = sprintf('news_reader_%s_%s_class', $command, $action);
-                       } // END - if
-               } // END - if
+                       }
+               }
 
                // Get the news reader class name from config
                $className = FrameworkBootstrap::getConfigurationInstance()->getConfigEntry($configEntry);
index b24f28847d78e7c150f6f57d4f822d5efcf83ffa..51de21d65febb40f8fc7928044e1bc255f504e7b 100644 (file)
@@ -7,6 +7,7 @@ use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
 use Org\Mxchange\CoreFramework\Registry\GenericRegistry;
 
 // Import SPL stuff
+use \InvalidArgumentException;
 use \SplFileInfo;
 
 /**
@@ -47,10 +48,14 @@ class FileStackIndexFactory extends ObjectFactory {
         *
         * @param       $infoInstance   An instance of a SplFileInfo class
         * @return      $indexInstance  An instance of a IndexableStack class
+        * @throws      InvalidArgumentException        If a parameter is invalid
         */
        public static final function createFileStackIndexInstance (SplFileInfo $infoInstance, string $type) {
                // If there is no handler?
-               if (GenericRegistry::getRegistry()->instanceExists($type . '_index')) {
+               if (empty($type)) {
+                       // Throw IAE
+                       throw new InvalidArgumentException('Parameter "type" is empty');
+               } elseif (GenericRegistry::getRegistry()->instanceExists($type . '_index')) {
                        // Get handler from registry
                        $indexInstance = GenericRegistry::getRegistry()->getInstance($type . '_index');
                } else {
index b10907b53e53795695f6ea2f9984300264b9a214..c081b6bd322943a54205be72217bc53cb5747729 100644 (file)
@@ -35,12 +35,12 @@ class ObjectFactory extends BaseFactory {
        /**
         * Protected constructor
         *
-        * @param       $fullClassName  Name of this class
+        * @param       $className      Name of this class
         * @return      void
         */
-       protected function __construct ($fullClassName = __CLASS__) {
+       protected function __construct (string $className = __CLASS__) {
                // Call parent constructor
-               parent::__construct($fullClassName);
+               parent::__construct($className);
        }
 
        /**
@@ -48,18 +48,18 @@ class ObjectFactory extends BaseFactory {
         * the class was not found. No parameters for the object are currently
         * supported.
         *
-        * @param       $fullClassName                  Name of the class we shall construct
+        * @param       $fullClassName          Name of the class we shall construct
         * @param       $args                           Arguments in an indexed array
         * @return      $objectInstance         An instance of the requested object
         * @throws      NoClassException        If the requested class was not found
         * @throws      InvalidArgumentException        If className is empty or the name not following naming-convention
         */
-       public static final function createObjectByName ($fullClassName, array $args = []) {
+       public static final function createObjectByName (string $fullClassName, array $args = []) {
                // Is the class name valid and is the class there?
                if (empty($fullClassName)) {
                        // Throw an exception here
-                       throw new InvalidArgumentException('Parameter "className" is empty');
-               } elseif (!class_exists($fullClassName)) {
+                       throw new InvalidArgumentException('Parameter "fullClassName" is empty');
+               } elseif (!self::isClassCounted($fullClassName) && !class_exists($fullClassName)) {
                        // First get an instance of this factory
                        $factoryInstance = new ObjectFactory();
 
@@ -74,13 +74,13 @@ class ObjectFactory extends BaseFactory {
                if (count($classNameParts) < 4) {
                        // Namespaces are missing
                        throw new InvalidArgumentException(sprintf('Class name "%s" is not conform to naming-convention: Tld\Domain\Project\Package[\SubPackage...]\SomeFooBar', $fullClassName));
-               } // END - if
+               }
 
                // Create method name
                $methodName = sprintf('create%s', self::stripNamespaceFromClassName($fullClassName));
 
                // Run the user function
-               $objectInstance = call_user_func_array(array($fullClassName, $methodName), $args);
+               $objectInstance = call_user_func_array([$fullClassName, $methodName], $args);
 
                // Count this one up
                self::countObject($fullClassName);
@@ -92,13 +92,13 @@ class ObjectFactory extends BaseFactory {
        /**
         * Creates an object by it's configured name
         *
-        * @param       $configEnttry           Configuration entry to read
+        * @param       $configKey              Configuration key to read
         * @param       $args                           Arguments in an indexed array
         * @return      $objectInstance         An instance of the requested object
         */
-       public static final function createObjectByConfiguredName ($configEntry, array $args = []) {
+       public static final function createObjectByConfiguredName (string $configKey, array $args = []) {
                // Read the configuration entry
-               $fullClassName = FrameworkBootstrap::getConfigurationInstance()->getConfigEntry($configEntry);
+               $fullClassName = FrameworkBootstrap::getConfigurationInstance()->getConfigEntry($configKey);
 
                // Send this to the other factory...
                $objectInstance = self::createObjectByName($fullClassName, $args);
@@ -115,7 +115,7 @@ class ObjectFactory extends BaseFactory {
         * @param       $fullClassName  Class name with namespace
         * @return      $shortClassName Stripped class name (no namespace)
         */
-       private static function stripNamespaceFromClassName ($fullClassName) {
+       private static function stripNamespaceFromClassName (string $fullClassName) {
                // The class name should contain at least 2 back-slashes, so split at them
                $classNameParts = explode("\\", $fullClassName);
 
index 172550a6259ad4bc375c70582a8aefcacd9f320b..04f8fce7382a1e87a0c1f1ecf8dc4ca86b5148bf 100644 (file)
@@ -46,17 +46,17 @@ class XmlTemplateEngineFactory extends ObjectFactory {
         * the registry it will be returned, else a new instance is created and
         * stored in the same registry entry.
         *
-        * @param       $configEntry            Config entry name for the template engine
+        * @param       $configKey              Config entry name for the template engine
         * @return      $templateInstance       A template engine instance
         */
-       public static final function createXmlTemplateEngineInstance (string $configEntry) {
+       public static final function createXmlTemplateEngineInstance (string $configKey) {
                // Do we have an instance in the registry?
-               if (GenericRegistry::getRegistry()->instanceExists($configEntry)) {
+               if (GenericRegistry::getRegistry()->instanceExists($configKey)) {
                        // Then use this instance
-                       $templateInstance = GenericRegistry::getRegistry()->getInstance($configEntry);
+                       $templateInstance = GenericRegistry::getRegistry()->getInstance($configKey);
                } else {
-                       // Now prepare the tags instance
-                       $templateInstance = ObjectFactory::createObjectByConfiguredName($configEntry);
+                       // Get the XML template instance
+                       $templateInstance = ObjectFactory::createObjectByConfiguredName($configKey);
 
                        // Disable language support
                        $templateInstance->enableLanguageSupport(false);
@@ -68,7 +68,7 @@ class XmlTemplateEngineFactory extends ObjectFactory {
                        $templateInstance->enableXmlCompacting();
 
                        // Set the instance in registry for further use
-                       GenericRegistry::getRegistry()->addInstance($configEntry, $templateInstance);
+                       GenericRegistry::getRegistry()->addInstance($configKey, $templateInstance);
                }
 
                // Return the instance
diff --git a/framework/main/exceptions/main/class_InvalidObjectException.php b/framework/main/exceptions/main/class_InvalidObjectException.php
deleted file mode 100644 (file)
index 7b55f5e..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-<?php
-// Own namespace
-namespace Org\Mxchange\CoreFramework\Deprecated;
-
-// Import framework stuff
-use Org\Mxchange\CoreFramework\Generic\FrameworkException;
-use Org\Mxchange\CoreFramework\Generic\FrameworkInterface;
-
-/**
- * An exception thrown when an instance variable instances a non-object 
- *
- * @author             Roland Haeder <webmaster@shipsimu.org>
- * @version            0.0.0
- * @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
- * @deprecated Don't use this anymore
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-class InvalidObjectException extends FrameworkException {
-       /**
-        * The constructor
-        *
-        * @param       $class  Class throwing the exception
-        * @param       $code   Code number for the exception
-        * @return      void
-        */
-       public function __construct (FrameworkInterface $class, int $code) {
-               // Add a message around the missing class
-               $message = sprintf('[%s:%d] Object is not allowed here.',
-                       $class->__toString(),
-                       $this->getLine()
-               );
-
-               // Call parent constructor
-               parent::__construct($message, $code);
-       }
-
-}
index ae996719c4d01ea9df1331c72a65a21f9d96ce03..df7ac71bbc2214795664a1cba2f8f7db6a767cbe 100644 (file)
@@ -33,7 +33,7 @@ interface Compressor extends FrameworkInterface {
         *
         * @param       $streamData             Mixed non-object stream data
         * @return      $streamData             The compressed stream data
-        * @throws      InvalidObjectException  If the stream is an object
+        * @throws      InvalidArgumentException        If the stream is not compressable or decompressable
         */
        function compressStream ($streamData);
 
@@ -42,7 +42,7 @@ interface Compressor extends FrameworkInterface {
         *
         * @param       $streamData             Mixed non-object stream data
         * @return      $streamData             The decompressed stream data
-        * @throws      InvalidObjectException  If the stream is an object
+        * @throws      InvalidArgumentException        If the stream is not compressable or decompressable
         */
        function decompressStream ($streamData);