// Import framework stuff
use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem;
-use Org\Mxchange\CoreFramework\Resolver\Resolver;
+use Org\Mxchange\CoreFramework\Traits\Resolver\ResolverTrait;
/**
* A general action class. You shall extend this class if you are going to write
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
abstract class BaseAction extends BaseFrameworkSystem {
- /**
- * Resolver instance
- */
- private $resolverInstance = NULL;
+ // Load traits
+ use ResolverTrait;
/**
* Protected constructor
parent::__construct($className);
}
- /**
- * Setter for resolver instance
- *
- * @param $resolverInstance Instance of a command resolver class
- * @return void
- */
- protected final function setResolverInstance (Resolver $resolverInstance) {
- $this->resolverInstance = $resolverInstance;
- }
-
- /**
- * Getter for resolver instance
- *
- * @return $resolverInstance Instance of a command resolver class
- */
- protected final function getResolverInstance () {
- return $this->resolverInstance;
- }
-
}
*/
private $realClass = __CLASS__;
- /**
- * State instance
- */
- private $stateInstance = NULL;
-
/**
* Call-back instance
*/
return $webOutputInstance;
}
- /**
- * Setter for state instance
- *
- * @param $stateInstance A Stateable instance
- * @return void
- */
- public final function setStateInstance (Stateable $stateInstance) {
- $this->stateInstance = $stateInstance;
- }
-
/**
* Getter for state instance
*
* "Getter" for a printable state name
*
* @return $stateName Name of the node's state in a printable format
+ * @todo Move this class away from this monolithic place (not whole class is monolithic)
*/
public final function getPrintableState () {
// Default is 'null'
use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem;
use Org\Mxchange\CoreFramework\Registry\GenericRegistry;
use Org\Mxchange\CoreFramework\Request\Requestable;
-use Org\Mxchange\CoreFramework\Resolver\Resolver;
use Org\Mxchange\CoreFramework\Response\Responseable;
-use Org\Mxchange\CoreFramework\Template\CompileableTemplate;
+use Org\Mxchange\CoreFramework\Traits\Resolver\ResolverTrait;
+use Org\Mxchange\CoreFramework\Traits\Template\CompileableTemplateTrait;
+
/**
* A general (base) command
*
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
abstract class BaseCommand extends BaseFrameworkSystem {
- /**
- * Resolver instance
- */
- private $resolverInstance = NULL;
-
- /**
- * Template engine instance
- */
- private $templateInstance = NULL;
+ // Load traits
+ use CompileableTemplateTrait;
+ use ResolverTrait;
/**
* Protected constructor
parent::__construct($className);
}
- /**
- * Setter for resolver instance
- *
- * @param $resolverInstance Instance of a command resolver class
- * @return void
- */
- protected final function setResolverInstance (Resolver $resolverInstance) {
- $this->resolverInstance = $resolverInstance;
- }
-
- /**
- * Getter for resolver instance
- *
- * @return $resolverInstance Instance of a command resolver class
- */
- protected final function getResolverInstance () {
- return $this->resolverInstance;
- }
-
- /**
- * Setter for template engine instances
- *
- * @param $templateInstance An instance of a CompileableTemplate class
- * @return void
- */
- protected final function setTemplateInstance (CompileableTemplate $templateInstance) {
- $this->templateInstance = $templateInstance;
- }
-
- /**
- * Getter for template engine instances
- *
- * @return $templateInstance An instance of a CompileableTemplate class
- */
- public final function getTemplateInstance () {
- return $this->templateInstance;
- }
-
/**
* Initializes the template engine
*
use Org\Mxchange\CoreFramework\Registry\GenericRegistry;
use Org\Mxchange\CoreFramework\Registry\Registerable;
use Org\Mxchange\CoreFramework\Request\Requestable;
-use Org\Mxchange\CoreFramework\Resolver\Resolver;
use Org\Mxchange\CoreFramework\Response\Responseable;
+use Org\Mxchange\CoreFramework\Traits\Resolver\ResolverTrait;
/**
* A generic controller class. You should extend this base class if you want to
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
abstract class BaseController extends BaseFrameworkSystem implements Registerable {
+ // Load traits
+ use ResolverTrait;
+
// Exception constants
const EXCEPTION_FILTER_CHAIN_INVALID = 0xf10;
const FILTER_CHAIN_PRE_COMMAND = 'controller_pre_command';
const FILTER_CHAIN_POST_COMMAND = 'controller_post_command';
- /**
- * Resolver instance
- */
- private $resolverInstance = NULL;
-
/**
* Generic filter chains
*/
GenericRegistry::getRegistry()->addInstance('controller', $this);
}
- /**
- * Setter for resolver instance
- *
- * @param $resolverInstance Instance of a command resolver class
- * @return void
- */
- protected final function setResolverInstance (Resolver $resolverInstance) {
- $this->resolverInstance = $resolverInstance;
- }
-
- /**
- * Getter for resolver instance
- *
- * @return $resolverInstance Instance of a command resolver class
- */
- protected final function getResolverInstance () {
- return $this->resolverInstance;
- }
-
/**
* Executes a command with pre and post filters
*
use Org\Mxchange\CoreFramework\Generic\BaseDecorator;
use Org\Mxchange\CoreFramework\Response\Responseable;
use Org\Mxchange\CoreFramework\Template\CompileableTemplate;
+use Org\Mxchange\CoreFramework\Traits\Template\CompileableTemplateTrait;
/**
* A decorator for XML template engines which rewrites the XML for compacting
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class XmlRewriterTemplateDecorator extends BaseDecorator implements CompileableTemplate {
- /**
- * Template engine instance
- */
- private $templateInstance = NULL;
+ // Load traits
+ use CompileableTemplateTrait;
/**
* Protected constructor
return $templateInstance;
}
- /**
- * Setter for template engine instances
- *
- * @param $templateInstance An instance of a CompileableTemplate class
- * @return void
- */
- protected final function setTemplateInstance (CompileableTemplate $templateInstance) {
- $this->templateInstance = $templateInstance;
- }
-
- /**
- * Getter for template engine instances
- *
- * @return $templateInstance An instance of a CompileableTemplate class
- */
- protected final function getTemplateInstance () {
- return $this->templateInstance;
- }
-
/**
* Settter for variable group
*
// Import framework stuff
use Org\Mxchange\CoreFramework\Helper\BaseHelper;
-use Org\Mxchange\CoreFramework\Template\CompileableTemplate;
+use Org\Mxchange\CoreFramework\Traits\Template\CompileableTemplateTrait;
/**
* A general purpose web helper. You should not instance this like all the other
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
abstract class BaseHtmlHelper extends BaseHelper {
-
- /**
- * Template engine instance
- */
- private $templateInstance = NULL;
+ // Load traits
+ use CompileableTemplateTrait;
/**
* Protected constructor
parent::__construct($className);
}
- /**
- * Setter for template engine instances
- *
- * @param $templateInstance An instance of a CompileableTemplate class
- * @return void
- */
- protected final function setTemplateInstance (CompileableTemplate $templateInstance) {
- $this->templateInstance = $templateInstance;
- }
-
- /**
- * Getter for template engine instances
- *
- * @return $templateInstance An instance of a CompileableTemplate class
- */
- public final function getTemplateInstance () {
- return $this->templateInstance;
- }
-
}
* @param $withForm Whether include the form tag
* @return $helperInstance A preparedf instance of this helper
*/
- public static final function createHtmlFormHelper (CompileableTemplate $templateInstance, $formName, $formId = false, $withForm = true) {
+ public static final function createHtmlFormHelper (CompileableTemplate $templateInstance, string $formName, $formId = false, bool $withForm = true) {
// Get new instance
$helperInstance = new HtmlFormHelper();
* @return $helperInstance A prepared instance of this helper
* @throws NoConfigEntryException A deprecated exception at this point
*/
- public static final function createHtmlLinkHelper (CompileableTemplate $templateInstance, $linkName, $linkBase = NULL) {
+ public static final function createHtmlLinkHelper (CompileableTemplate $templateInstance, string $linkName, $linkBase = NULL) {
// Get new instance
$helperInstance = new HtmlLinkHelper();
// Import framework stuff
use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem;
use Org\Mxchange\CoreFramework\Registry\Registerable;
-use Org\Mxchange\CoreFramework\Template\CompileableTemplate;
+use Org\Mxchange\CoreFramework\Traits\Template\CompileableTemplateTrait;
/**
* A general image class
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
abstract class BaseImage extends BaseFrameworkSystem implements Registerable {
+ // Load traits
+ use CompileableTemplateTrait;
+
/**
* Image type
*/
/**
* Width of the image
*/
- private $width = '';
+ private $width = 0;
/**
* Height of the image
*/
- private $height = '';
+ private $height = 0;
/**
* X/Y
*/
- private $x = '';
- private $y = '';
+ private $x = 0;
+ private $y = 0;
/**
* Font size
*/
- private $fontSize = '';
+ private $fontSize = 0;
/**
* Image string
*/
private $groupable = 'single';
- /**
- * Template engine instance
- */
- private $templateInstance = NULL;
-
/**
* Protected constructor
*
$this->stringName = $stringName;
}
- /**
- * Setter for template engine instances
- *
- * @param $templateInstance An instance of a CompileableTemplate class
- * @return void
- */
- protected final function setTemplateInstance (CompileableTemplate $templateInstance) {
- $this->templateInstance = $templateInstance;
- }
-
- /**
- * Getter for template engine instances
- *
- * @return $templateInstance An instance of a CompileableTemplate class
- */
- public final function getTemplateInstance () {
- return $this->templateInstance;
- }
-
/**
* Finish this image by producing it
*
use Org\Mxchange\CoreFramework\Generic\FrameworkInterface;
use Org\Mxchange\CoreFramework\Manager\Login\ManageableMember;
use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem;
-use Org\Mxchange\CoreFramework\Template\CompileableTemplate;
+use Org\Mxchange\CoreFramework\Traits\Template\CompileableTemplateTrait;
/**
* A general mailer class for all other mailers
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
abstract class BaseMailer extends BaseFrameworkSystem {
+ // Load traits
+ use CompileableTemplateTrait;
+
/**
* Template name
*/
private $templateName = '';
- /**
- * Template engine instance
- */
- private $templateInstance = NULL;
-
/**
* Protected constructor
*
return $this->getGenericArray('recipients');
}
- /**
- * Setter for template engine instances
- *
- * @param $templateInstance An instance of a CompileableTemplate class
- * @return void
- */
- protected final function setTemplateInstance (CompileableTemplate $templateInstance) {
- $this->templateInstance = $templateInstance;
- }
-
- /**
- * Getter for template engine instances
- *
- * @return $templateInstance An instance of a CompileableTemplate class
- */
- public final function getTemplateInstance () {
- return $this->templateInstance;
- }
-
}
use Org\Mxchange\CoreFramework\Filesystem\FileNotFoundException;
use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem;
use Org\Mxchange\CoreFramework\Registry\GenericRegistry;
-use Org\Mxchange\CoreFramework\Template\CompileableTemplate;
+use Org\Mxchange\CoreFramework\Traits\Template\CompileableTemplateTrait;
/**
* A general menu system class
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
abstract class BaseMenu extends BaseFrameworkSystem {
-
- /**
- * Template engine instance
- */
- private $templateInstance = NULL;
+ // Load traits
+ use CompileableTemplateTrait;
/**
* Protected constructor
parent::__construct($className);
}
- /**
- * Setter for template engine instances
- *
- * @param $templateInstance An instance of a CompileableTemplate class
- * @return void
- */
- protected final function setTemplateInstance (CompileableTemplate $templateInstance) {
- $this->templateInstance = $templateInstance;
- }
-
- /**
- * Getter for template engine instances
- *
- * @return $templateInstance An instance of a CompileableTemplate class
- */
- public final function getTemplateInstance () {
- return $this->templateInstance;
- }
-
/**
* Renders the menu by loading the base template and a menu-specific
* template.
// Import framework stuff
use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem;
-use Org\Mxchange\CoreFramework\Template\CompileableTemplate;
+use Org\Mxchange\CoreFramework\Traits\Template\CompileableTemplateTrait;
/**
* A general Parser
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
abstract class BaseParser extends BaseFrameworkSystem {
- /**
- * Template engine instance
- */
- private $templateInstance = NULL;
+ // Load traits
+ use CompileableTemplateTrait;
/**
* Protected constructor
parent::__construct($className);
}
- /**
- * Setter for template engine instances
- *
- * @param $templateInstance An instance of a CompileableTemplate class
- * @return void
- */
- public final function setTemplateInstance (CompileableTemplate $templateInstance) {
- $this->templateInstance = $templateInstance;
- }
-
- /**
- * Getter for template engine instances
- *
- * @return $templateInstance An instance of a CompileableTemplate class
- */
- public final function getTemplateInstance () {
- return $this->templateInstance;
- }
-
}
* @return $isValid Whether the given action is valid
* @throws InvalidArgumentException Thrown if given action is not set
*/
- public function isActionValid ($namespace, $actionName) {
+ public function isActionValid (string $namespace, string $actionName) {
// Is a action set?
if (empty($namespace)) {
// Then thrown an exception here
* @return $isValid Whether the given command is valid
* @throws InvalidArgumentException Thrown if given command is not set
*/
- protected function isCommandValid ($namespace, $commandName) {
+ protected function isCommandValid (string $namespace, string $commandName) {
// Is namespace and command name set?
if (empty($namespace)) {
// Then thrown an exception here
* @throws InvalidArgumentException Thrown if default command is not set
* @throws InvalidCommandException Thrown if default command is invalid
*/
- public static final function createConsoleCommandResolver ($namespace, $commandName) {
+ public static final function createConsoleCommandResolver (string $namespace, string $commandName) {
// Create the new instance
$resolverInstance = new ConsoleCommandResolver();
* @throws InvalidArgumentException Thrown if default command is not set
* @throws InvalidCommandException Thrown if default command is invalid
*/
- public static final function createHtmlCommandResolver ($commandName) {
+ public static final function createHtmlCommandResolver (string $commandName) {
// Create the new instance
$resolverInstance = new HtmlCommandResolver();
throw new InvalidArgumentException('Parameter "commandName" is empty');
} elseif ($resolverInstance->isCommandValid($commandName) === false) {
// Invalid command found
+ // @TODO Missing namespace!
throw new InvalidCommandException(array($resolverInstance, $commandName), self::EXCEPTION_INVALID_COMMAND);
}
* @throws InvalidArgumentException Thrown if default command is not set
* @throws InvalidCommandException Thrown if default command is invalid
*/
- public static final function createImageCommandResolver ($commandName) {
+ public static final function createImageCommandResolver (string $commandName) {
// Create the new instance
$resolverInstance = new ImageCommandResolver();
// Then thrown an exception here
throw new InvalidArgumentException('Parameter "commandName" is empty');
} elseif ($resolverInstance->isCommandValid($commandName) === false) {
+ // @TODO Missing namespace!
// Invalid command found
throw new InvalidCommandException(array($resolverInstance, $commandName), self::EXCEPTION_INVALID_COMMAND);
}
* @return void
* @throws InvalidXmlNodeException If an unknown/invalid XML node name was found
*/
- public function startElement ($resource, $element, array $attributes) {
+ public function startElement ($resource, string $element, array $attributes) {
// Initial method name which will never be called...
$methodName = 'initImage';
* @return void
* @throws XmlNodeMismatchException If current main node mismatches the closing one
*/
- public function finishElement ($resource, $nodeName) {
- // Make all lower-case
- $nodeName = strtolower($nodeName);
-
+ public function finishElement ($resource, string $nodeName) {
// Does this match with current main node?
//* DEBUG: */ echo "END: >".$nodeName."<<br />\n";
if (($nodeName != $this->getCurrMainNode()) && (in_array($nodeName, $this->getMainNodes()))) {
/**
* Main nodes in the XML tree
*/
- private $mainNodes = array(
+ private $mainNodes = [
'mail-data'
- );
+ ];
/**
* Sub nodes in the XML tree
*/
- private $subNodes = array(
+ private $subNodes = [
'subject-line',
'sender-address',
'recipient-address',
'message'
- );
+ ];
/**
* Mailer instance
* @return void
* @throws InvalidXmlNodeException If an unknown/invalid XML node name was found
*/
- public function startElement ($resource, $element, array $attributes) {
+ public function startElement ($resource, string $element, array $attributes) {
// Initial method name which will never be called...
$methodName = 'initEmail';
* @return void
* @throws XmlNodeMismatchException If current main node mismatches the closing one
*/
- public function finishElement ($resource, $nodeName) {
- // Make all lower-case
- $nodeName = strtolower($nodeName);
-
+ public function finishElement ($resource, string $nodeName) {
// Does this match with current main node?
//* DEBUG: */ echo "END: >".$nodeName."<<br />\n";
if (($nodeName != $this->getCurrMainNode()) && (in_array($nodeName, $this->getMainNodes()))) {
use Org\Mxchange\CoreFramework\Menu\RenderableMenu;
use Org\Mxchange\CoreFramework\Parser\Parseable;
use Org\Mxchange\CoreFramework\Registry\GenericRegistry;
-use Org\Mxchange\CoreFramework\Template\CompileableTemplate;
use Org\Mxchange\CoreFramework\Template\Engine\BaseTemplateEngine;
+use Org\Mxchange\CoreFramework\Template\CompileableTemplate;
+use Org\Mxchange\CoreFramework\Traits\Template\CompileableTemplateTrait;
use Org\Mxchange\CoreFramework\Utils\String\StringUtils;
// Import SPL stuff
*/
private $menuInstance = NULL;
- /**
- * Template engine instance
- */
- private $templateInstance = NULL;
-
/**
* Protected constructor
*
return $this->menuInstance;
}
- /**
- * Setter for template engine instances
- *
- * @param $templateInstance An instance of a CompileableTemplate class
- * @return void
- */
- protected final function setTemplateInstance (CompileableTemplate $templateInstance) {
- $this->templateInstance = $templateInstance;
- }
-
- /**
- * Getter for template engine instances
- *
- * @return $templateInstance An instance of a CompileableTemplate class
- */
- public final function getTemplateInstance () {
- return $this->templateInstance;
- }
-
/**
* Load a specified menu template into the engine
*
* located in 'menu' by default
* @return void
*/
- public function loadMenuTemplate ($template) {
+ public function loadMenuTemplate (string $template) {
// Set template type
$this->setTemplateType(FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('menu_template_type'));
* @param $element Element name to set as current main node
* @return $currMainNode Current main node
*/
- private final function setCurrMainNode ($element) {
- $this->curr['main_node'] = (string) $element;
+ private final function setCurrMainNode (string $element) {
+ $this->curr['main_node'] = $element;
}
/**
* @return void
* @throws InvalidXmlNodeException If an unknown/invalid XML node name was found
*/
- public function startElement ($resource, $element, array $attributes) {
+ public function startElement ($resource, string $element, array $attributes) {
// Initial method name which will never be called...
$methodName = 'initMenu';
* @return void
* @throws XmlNodeMismatchException If current main node mismatches the closing one
*/
- public function finishElement ($resource, $nodeName) {
- // Make all lower-case
- $nodeName = strtolower($nodeName);
-
+ public function finishElement ($resource, string $nodeName) {
// Does this match with current main node?
//* DEBUG: */ echo "END: >".$nodeName."<<br />\n";
if (($nodeName != $this->getCurrMainNode()) && (in_array($nodeName, $this->getMainNodes()))) {
* @return $isValid Whether the given action is valid
* @throws InvalidArgumentException Thrown if namespace or action is not set
*/
- function isActionValid ($namespace, $actionName);
+ function isActionValid (string $namespace, string $actionName);
}
* @throws InvalidArgumentException Thrown if default command is not set
* @throws InvalidCommandException Thrown if default command is invalid
*/
- public static final function createTestsConsoleCommandResolver ($commandName) {
+ public static final function createTestsConsoleCommandResolver (string $commandName) {
// Create the new instance
$resolverInstance = new TestsConsoleCommandResolver();
--- /dev/null
+<?php
+// Own namespace
+namespace Org\Mxchange\CoreFramework\Traits\Resolver;
+
+// Import framework stuff
+use Org\Mxchange\CoreFramework\Resolver\Resolver;
+
+/**
+ * A trait for resolver
+ *
+ * @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 ResolverTrait {
+ /**
+ * Resolver instance
+ */
+ private $resolverInstance = NULL;
+
+ /**
+ * Setter for resolver instance
+ *
+ * @param $resolverInstance Instance of a command resolver class
+ * @return void
+ */
+ protected final function setResolverInstance (Resolver $resolverInstance) {
+ $this->resolverInstance = $resolverInstance;
+ }
+
+ /**
+ * Getter for resolver instance
+ *
+ * @return $resolverInstance Instance of a command resolver class
+ */
+ protected final function getResolverInstance () {
+ return $this->resolverInstance;
+ }
+
+}
--- /dev/null
+<?php
+// Own namespace
+namespace Org\Mxchange\CoreFramework\Traits\State;
+
+use Org\Mxchange\CoreFramework\State\Stateable;
+
+/**
+ * A trait for states
+ *
+ * @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 StateableTrait {
+ /**
+ * State instance
+ */
+ private $stateInstance = NULL;
+
+ /**
+ * Setter for state instance
+ *
+ * @param $stateInstance A Stateable instance
+ * @return void
+ */
+ public final function setStateInstance (Stateable $stateInstance) {
+ $this->stateInstance = $stateInstance;
+ }
+
+ /**
+ * Getter for state instance
+ *
+ * @return $stateInstance A Stateable instance
+ */
+ public final function getStateInstance () {
+ return $this->stateInstance;
+ }
+
+}
--- /dev/null
+<?php
+// Own namespace
+namespace Org\Mxchange\CoreFramework\Traits\Template;
+
+// Import framework stuff
+use Org\Mxchange\CoreFramework\Template\CompileableTemplate;
+
+/**
+ * A trait for compileable templates
+ *
+ * @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 CompileableTemplateTrait {
+ /**
+ * Template engine instance
+ */
+ private $templateInstance = NULL;
+
+ /**
+ * Setter for template engine instances
+ *
+ * @param $templateInstance An instance of a CompileableTemplate class
+ * @return void
+ */
+ protected final function setTemplateInstance (CompileableTemplate $templateInstance) {
+ $this->templateInstance = $templateInstance;
+ }
+
+ /**
+ * Getter for template engine instances
+ *
+ * @return $templateInstance An instance of a CompileableTemplate class
+ */
+ public final function getTemplateInstance () {
+ return $this->templateInstance;
+ }
+
+}