Continued:
[core.git] / framework / main / classes / response / class_BaseResponse.php
index bb21e39197c9ad621be7acddd1b39e104059277e..625c1d95b38f30600c984452bedb7bb86d8a5a1a 100644 (file)
@@ -1,10 +1,10 @@
 <?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\Object\BaseFrameworkSystem;
+use Org\Mxchange\CoreFramework\Registry\GenericRegistry;
 
 /**
  * A generic request class
@@ -31,7 +31,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
         */
@@ -151,8 +151,11 @@ class BaseResponse extends BaseFrameworkSystem {
         * @return      void
         */
        public final function addFatalMessage ($messageId) {
+               // Get application instance
+               $applicationInstance = GenericRegistry::getRegistry()->getInstance('application');
+
                // Adds the resolved message id to the fatal message list
-               $this->addFatalMessagePlain($this->getApplicationInstance()->getLanguageInstance()->getMessage($messageId));
+               $this->addFatalMessagePlain($applicationInstance()->getLanguageInstance()->getMessage($messageId));
        }
 
        /**
@@ -175,8 +178,12 @@ class BaseResponse extends BaseFrameworkSystem {
         * @throws      ResponseHeadersAlreadySentException             Thrown if headers are
         *                                                                                                      already sent
         */
-       public function flushBuffer ($force = FALSE) {
-               if ((headers_sent()) && ($force === FALSE)) {
+       public function flushBuffer ($force = false) {
+               // Get application instance
+               $applicationInstance = GenericRegistry::getRegistry()->getInstance('application');
+
+               // Headers already sent?
+               if ((headers_sent()) && ($force === false)) {
                        // Headers are already sent!
                        throw new ResponseHeadersAlreadySentException($this, self::EXCEPTION_HEADERS_ALREADY_SENT);
                } elseif (!headers_sent()) {
@@ -218,7 +225,7 @@ class BaseResponse extends BaseFrameworkSystem {
                        $this->getWebOutputInstance()->output($this->responseBody);
                } else {
                        // Display all error messages
-                       $this->getApplicationInstance()->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);
@@ -236,7 +243,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',