]> git.mxchange.org Git - core.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Sat, 7 Nov 2020 21:11:16 +0000 (22:11 +0100)
committerRoland Häder <roland@mxchange.org>
Sat, 7 Nov 2020 21:11:16 +0000 (22:11 +0100)
- added missing $templateInstance, some chaos is normal after a rewrite
- added missing type-hints for primitive variables

Signed-off-by: Roland Häder <roland@mxchange.org>
framework/main/classes/commands/class_BaseCommand.php
framework/main/classes/resolver/class_BaseResolver.php
framework/main/classes/response/class_BaseResponse.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
         *
index 7b262c3766c8824bd331a523ddaf7977dcee14ad..c92a0ab263bd386565c1ff7b10aaeb9c475c14c1 100644 (file)
@@ -88,8 +88,8 @@ abstract class BaseResolver extends BaseFrameworkSystem {
         * @param       $namespace      Namespace to look in
         * @return      void
         */
-       protected final function setNamespace ($namespace) {
-               $this->namespace = (string) $namespace;
+       protected final function setNamespace (string $namespace) {
+               $this->namespace = $namespace;
        }
 
        /**
@@ -107,8 +107,8 @@ abstract class BaseResolver extends BaseFrameworkSystem {
         * @param       $className      Name of the class
         * @return      void
         */
-       protected final function setClassName ($className) {
-               $this->className = (string) $className;
+       protected final function setClassName (string $className) {
+               $this->className = $className;
        }
 
        /**
index ece0dbd269f2dc66473f46b1c7069923f06bdea6..a52a53bf5a6e56f00a5585da75b74cb760db13db 100644 (file)
@@ -53,11 +53,6 @@ abstract class BaseResponse extends BaseFrameworkSystem {
         */
        private $responseBody = '';
 
-       /**
-        * Instance of the template engine
-        */
-       private $templateInstance = NULL;
-
        /**
         * Response type
         */