]> git.mxchange.org Git - core.git/commitdiff
Refacturing:
authorRoland Häder <roland@mxchange.org>
Wed, 2 Dec 2020 05:45:15 +0000 (06:45 +0100)
committerRoland Häder <roland@mxchange.org>
Wed, 2 Dec 2020 05:45:15 +0000 (06:45 +0100)
- extracted $stack as trait

Signed-off-by: Roland Häder <roland@mxchange.org>
framework/main/classes/template/class_BaseTemplateEngine.php
framework/main/traits/stacker/class_StackableTrait.php [new file with mode: 0644]

index 9209305fab3e97c4e0c4c1dadbb6bb891efa4f9a..2d30141ec8004c9f1fc1190a5cdff3420b5cdda6 100644 (file)
@@ -12,7 +12,6 @@ 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\Stacker\Stackable;
 use Org\Mxchange\CoreFramework\Traits\Handler\Io\IoHandlerTrait;
 use Org\Mxchange\CoreFramework\Utils\String\StringUtils;
 
@@ -176,11 +175,6 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
         */
        private $xmlCompacting = false;
 
-       /**
-        * Instance of the stacker
-        */
-       private $stackInstance = NULL;
-
        /**
         * Protected constructor
         *
@@ -1619,25 +1613,6 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
                return $this->xmlCompacting;
        }
 
-       /**
-        * Setter for stacker instance
-        *
-        * @param       $stackInstance  An instance of an stacker
-        * @return      void
-        */
-       protected final function setStackInstance (Stackable $stackInstance) {
-               $this->stackInstance = $stackInstance;
-       }
-
-       /**
-        * Getter for stacker instance
-        *
-        * @return      $stackInstance  An instance of an stacker
-        */
-       public final function getStackInstance () {
-               return $this->stackInstance;
-       }
-
        /**
         * Removes all commentd, tabs and new-line characters to compact the content
         *
diff --git a/framework/main/traits/stacker/class_StackableTrait.php b/framework/main/traits/stacker/class_StackableTrait.php
new file mode 100644 (file)
index 0000000..c693ac8
--- /dev/null
@@ -0,0 +1,56 @@
+<?php
+// Own namespace
+namespace Org\Mxchange\CoreFramework\Traits\Stacker;
+
+// Import framework stuff
+use Org\Mxchange\CoreFramework\Stacker\Stackable;
+
+/**
+ * A trait for stacker
+ *
+ * @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/>.
+ */
+trait StackableTrait {
+
+       /**
+        * Instance of the stacker
+        */
+       private $stackInstance = NULL;
+
+       /**
+        * Setter for stacker instance
+        *
+        * @param       $stackInstance  An instance of an stacker
+        * @return      void
+        */
+       protected final function setStackInstance (Stackable $stackInstance) {
+               $this->stackInstance = $stackInstance;
+       }
+
+       /**
+        * Getter for stacker instance
+        *
+        * @return      $stackInstance  An instance of an stacker
+        */
+       public final function getStackInstance () {
+               return $this->stackInstance;
+       }
+
+}