Introduced initWebOutputInstance() which will initialize a web output instance.
[core.git] / inc / classes / main / class_BaseFrameworkSystem.php
index cf0e5da7d4f96653cd13b68bd8bb49e4d6971152..c3bb447f2bf4f1128259572e845f114645c5a5cf 100644 (file)
@@ -1038,7 +1038,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
         * @param       $protocolInstance       An instance of an HandleableProtocol
         * @return      void
         */
-       public final function setProtocolInstance (HandleableProtocol $protocolInstance = NULL) {
+       public final function setProtocolInstance (HandleableProtocol $protocolInstance) {
                $this->protocolInstance = $protocolInstance;
        }
 
@@ -1322,6 +1322,22 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
                return $this->pointerInstance;
        }
 
+       /**
+        * Unsets pointer instance which triggers a call of __destruct() if the
+        * instance is still there. This is surely not fatal on already "closed"
+        * file pointer instances.
+        *
+        * I don't want to mess around with above setter by giving it a default
+        * value NULL as setter should always explicitly only set (existing) object
+        * instances and NULL is NULL.
+        *
+        * @return      void
+        */
+       protected final function unsetPointerInstance () {
+               // Simply it to NULL
+               $this->pointerInstance = NULL;
+       }
+
        /**
         * Setter for Indexable instance
         *
@@ -2933,6 +2949,28 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
                return $isValid;
        }
 
+       /**
+        * Initializes the web output instance
+        *
+        * @return      void
+        */
+       protected function initWebOutputInstance () {
+               // Get application instance
+               $applicationInstance = Registry::getRegistry()->getInstance('app');
+
+               // Is this a response instance?
+               if ($this instanceof Responseable) {
+                       // Then set it in application instance
+                       $applicationInstance->setResponseInstance($this);
+               } // END - if
+
+               // Init web output instance
+               $outputInstance = ObjectFactory::createObjectByConfiguredName('output_class', array($applicationInstance));
+
+               // Set it locally
+               $this->setWebOutputInstance($outputInstance);
+       }
+
        /**
         * Translates boolean TRUE to 'Y' and FALSE to 'N'
         *