]> git.mxchange.org Git - core.git/blobdiff - framework/main/classes/response/class_BaseResponse.php
Continued:
[core.git] / framework / main / classes / response / class_BaseResponse.php
index f7bbb7815bdb2a147b9fcc1b5767e199a0be21dc..a52a53bf5a6e56f00a5585da75b74cb760db13db 100644 (file)
@@ -1,17 +1,18 @@
 <?php
 // Own namespace
-namespace CoreFramework\Response;
+namespace Org\Mxchange\CoreFramework\Response;
 
 // Import framework stuff
-use CoreFramework\Object\BaseFrameworkSystem;
-use CoreFramework\Registry\Registry;
+use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
+use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem;
+use Org\Mxchange\CoreFramework\Registry\GenericRegistry;
 
 /**
  * A generic request class
  *
  * @author             Roland Haeder <webmaster@shipsimu.org>
  * @version            0.0.0
- * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2017 Core Developer Team
+ * @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
  *
@@ -31,7 +32,7 @@ use CoreFramework\Registry\Registry;
  * The extended headers are taken from phpMyAdmin setup tool, written by
  * Michal Cihar <michal@cihar.com>, licensed under GNU GPL 2.0.
  */
-class BaseResponse extends BaseFrameworkSystem {
+abstract class BaseResponse extends BaseFrameworkSystem {
        /**
         * Response status
         */
@@ -52,11 +53,6 @@ class BaseResponse extends BaseFrameworkSystem {
         */
        private $responseBody = '';
 
-       /**
-        * Instance of the template engine
-        */
-       private $templateInstance = NULL;
-
        /**
         * Response type
         */
@@ -68,7 +64,7 @@ class BaseResponse extends BaseFrameworkSystem {
         * @param       $className      Name of the concrete response
         * @return      void
         */
-       protected function __construct ($className) {
+       protected function __construct (string $className) {
                // Call parent constructor
                parent::__construct($className);
        }
@@ -152,10 +148,10 @@ class BaseResponse extends BaseFrameworkSystem {
         */
        public final function addFatalMessage ($messageId) {
                // Get application instance
-               $applicationInstance = Registry::getRegistry()->getInstance('app');
+               $applicationInstance = GenericRegistry::getRegistry()->getInstance('application');
 
                // Adds the resolved message id to the fatal message list
-               $this->addFatalMessagePlain($applicationInstance()->getLanguageInstance()->getMessage($messageId));
+               $this->addFatalMessagePlain($applicationInstance->getLanguageInstance()->getMessage($messageId));
        }
 
        /**
@@ -180,7 +176,7 @@ class BaseResponse extends BaseFrameworkSystem {
         */
        public function flushBuffer ($force = false) {
                // Get application instance
-               $applicationInstance = Registry::getRegistry()->getInstance('app');
+               $applicationInstance = GenericRegistry::getRegistry()->getInstance('application');
 
                // Headers already sent?
                if ((headers_sent()) && ($force === false)) {
@@ -200,7 +196,7 @@ class BaseResponse extends BaseFrameworkSystem {
                        $this->addHeader('Pragma', 'no-cache'); // HTTP/1.0
 
                        // Define the charset to be used
-                       //$this->addHeader('Content-type:', sprintf("text/html; charset=%s", $this->getConfigInstance()->getConfigEntry('header_charset')));
+                       //$this->addHeader('Content-type:', sprintf("text/html; charset=%s", FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('header_charset')));
 
                        // Send all headers
                        foreach ($this->responseHeaders as $name => $value) {
@@ -225,7 +221,7 @@ class BaseResponse extends BaseFrameworkSystem {
                        $this->getWebOutputInstance()->output($this->responseBody);
                } else {
                        // Display all error messages
-                       $applicationInstance()->handleFatalMessages($this->getGenericArrayKey('fatal_messages', 'generic', 'message'));
+                       $applicationInstance->handleFatalMessages($this->getGenericArrayKey('fatal_messages', 'generic', 'message'));
 
                        // Send the error messages out to the world
                        $this->getWebOutputInstance()->output($this->responseBody);
@@ -243,7 +239,7 @@ class BaseResponse extends BaseFrameworkSystem {
         */
        public function determineDefaultCommand () {
                // Get application instance
-               $applicationInstance = Registry::getRegistry()->getInstance('app');
+               $applicationInstance = GenericRegistry::getRegistry()->getInstance('application');
 
                // Generate config key
                $configKey = sprintf('default_%s_%s_command',
@@ -252,7 +248,7 @@ class BaseResponse extends BaseFrameworkSystem {
                );
 
                // Get default command response
-               $defaultCommand = $this->getConfigInstance()->getConfigEntry($configKey);
+               $defaultCommand = FrameworkBootstrap::getConfigurationInstance()->getConfigEntry($configKey);
 
                // Return it
                return $defaultCommand;