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
*
*/
private $resolverInstance = NULL;
+ /**
+ * Template engine instance
+ */
+ private $templateInstance = NULL;
+
/**
* Protected constructor
*
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
*
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
*
* @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;
}
/**
* @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;
}
/**