From 1864dbbc8271cdcccd836823ecffae01dc9f017b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Wed, 2 Dec 2020 06:45:15 +0100 Subject: [PATCH] Refacturing: - extracted $stack as trait MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- .../template/class_BaseTemplateEngine.php | 25 --------- .../traits/stacker/class_StackableTrait.php | 56 +++++++++++++++++++ 2 files changed, 56 insertions(+), 25 deletions(-) create mode 100644 framework/main/traits/stacker/class_StackableTrait.php diff --git a/framework/main/classes/template/class_BaseTemplateEngine.php b/framework/main/classes/template/class_BaseTemplateEngine.php index 9209305f..2d30141e 100644 --- a/framework/main/classes/template/class_BaseTemplateEngine.php +++ b/framework/main/classes/template/class_BaseTemplateEngine.php @@ -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 index 00000000..c693ac89 --- /dev/null +++ b/framework/main/traits/stacker/class_StackableTrait.php @@ -0,0 +1,56 @@ + + * @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 . + */ +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; + } + +} -- 2.39.2