]> git.mxchange.org Git - core.git/blobdiff - framework/main/classes/commands/class_BaseCommand.php
Continued:
[core.git] / framework / main / classes / commands / class_BaseCommand.php
index c7e0e9e06d258525efb31f53ed7712b8bca16558..8642dedf18c5309d9b02da2a6f1c2c3159394023 100644 (file)
@@ -9,7 +9,7 @@ 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;
 /**
  * A general (base) command
  *
@@ -38,6 +38,11 @@ abstract class BaseCommand extends BaseFrameworkSystem {
         */
        private $resolverInstance = NULL;
 
+       /**
+        * Template engine instance
+        */
+       private $templateInstance = NULL;
+
        /**
         * Protected constructor
         *
@@ -49,20 +54,6 @@ abstract class BaseCommand extends BaseFrameworkSystem {
                parent::__construct($className);
        }
 
-       /**
-        * Initializes the template engine
-        *
-        * @param       $templateType   Type of template, e.g. 'html', 'image', 'console' ...
-        * @return      void
-        */
-       public final function initTemplateEngine (string $templateType) {
-               // Prepare a template instance
-               $templateInstance = ObjectFactory::createObjectByConfiguredName(sprintf('%s_template_class', $templateType));
-
-               // Set it here
-               $this->setTemplateInstance($templateInstance);
-       }
-
        /**
         * Setter for resolver instance
         *
@@ -82,6 +73,39 @@ abstract class BaseCommand extends BaseFrameworkSystem {
                return $this->resolverInstance;
        }
 
+       /**
+        * Setter for template engine instances
+        *
+        * @param       $templateInstance       An instance of a template engine class
+        * @return      void
+        */
+       protected final function setTemplateInstance (CompileableTemplate $templateInstance) {
+               $this->templateInstance = $templateInstance;
+       }
+
+       /**
+        * Getter for template engine instances
+        *
+        * @return      $templateInstance       An instance of a template engine class
+        */
+       public final function getTemplateInstance () {
+               return $this->templateInstance;
+       }
+
+       /**
+        * Initializes the template engine
+        *
+        * @param       $templateType   Type of template, e.g. 'html', 'image', 'console' ...
+        * @return      void
+        */
+       public final function initTemplateEngine (string $templateType) {
+               // Prepare a template instance
+               $templateInstance = ObjectFactory::createObjectByConfiguredName(sprintf('%s_template_class', $templateType));
+
+               // Set it here
+               $this->setTemplateInstance($templateInstance);
+       }
+
        /**
         * Sends a generic HTTP response with header, menu, content and footer
         *