Continued:
[core.git] / framework / main / classes / response / image / class_ImageResponse.php
index 58e3e41fb1e5879a27116da8d4ff6a3890407716..a2fc7a065b5a34ee367f681aeca2c886ea5a9219 100644 (file)
@@ -1,10 +1,10 @@
 <?php
 // Own namespace
-namespace CoreFramework\Response;
+namespace Org\Mxchange\CoreFramework\Response;
 
 // Import framework stuff
-use CoreFramework\Manager\ManageableApplication;
-use CoreFramework\Response\Responseable;
+use Org\Mxchange\CoreFramework\Registry\GenericRegistry;
+use Org\Mxchange\CoreFramework\Response\Responseable;
 
 /**
  * A class for an image response on an HTTP request
@@ -48,22 +48,12 @@ class ImageResponse extends BaseResponse implements Responseable {
        /**
         * Creates an object of this class
         *
-        * @param       $applicationInstance    An instance of a manageable application
-        * @return      $responseInstance               A prepared instance of this class
+        * @return      $responseInstance       A prepared instance of this class
         */
-       public static final function createImageResponse (ManageableApplication $applicationInstance) {
+       public static final function createImageResponse () {
                // Get a new instance
                $responseInstance = new ImageResponse();
 
-               // Set the application instance
-               $responseInstance->setApplicationInstance($applicationInstance);
-
-               // Initialize the template engine here
-               $responseInstance->initTemplateEngine($applicationInstance);
-
-               // Init web output instance
-               $responseInstance->initWebOutputInstance();
-
                // Return the prepared instance
                return $responseInstance;
        }
@@ -104,7 +94,7 @@ class ImageResponse extends BaseResponse implements Responseable {
         * @todo        If the return statement is removed and setcookie() commented out,
         * @todo        this will send only one cookie out, the first one.
         */
-       public function addCookie ($cookieName, $cookieValue, $encrypted = FALSE, $expires = NULL) {
+       public function addCookie ($cookieName, $cookieValue, $encrypted = false, $expires = NULL) {
                // Are headers already sent?
                if (headers_sent()) {
                        // Throw an exception here
@@ -112,7 +102,7 @@ class ImageResponse extends BaseResponse implements Responseable {
                } // END - if
 
                // Shall we encrypt the cookie?
-               if ($encrypted === TRUE) {
+               if ($encrypted === true) {
                        // Unsupported at the moment
                        $this->partialStub('Encryption is unsupported at the moment.');
                } // END - if
@@ -150,6 +140,9 @@ class ImageResponse extends BaseResponse implements Responseable {
         * @throws      ResponseHeadersAlreadySentException             If headers are already sent
         */
        public function redirectToConfiguredUrl ($configEntry) {
+               // Get application instance
+               $applicationInstance = GenericRegistry::getRegistry()->getInstance('application');
+
                // Is the header not yet sent?
                if (headers_sent()) {
                        // Throw an exception here
@@ -157,7 +150,7 @@ class ImageResponse extends BaseResponse implements Responseable {
                } // END - if
 
                // Assign application data
-               $this->getTemplateInstance()->assignApplicationData($this->getApplicationInstance());
+               $this->getTemplateInstance()->assignApplicationData($applicationInstance());
 
                // Get the url from config
                $url = $this->getConfigInstance()->getConfigEntry($configEntry . '_url');
@@ -197,7 +190,7 @@ class ImageResponse extends BaseResponse implements Responseable {
         *                                      already sent with an exception
         * @return      void
         */
-       public function flushBuffer ($force = FALSE) {
+       public function flushBuffer ($force = false) {
                // Finish the image
                $this->getImageInstance()->finishImage();
 
@@ -224,7 +217,7 @@ class ImageResponse extends BaseResponse implements Responseable {
                // Is the cookie there?
                if (isset($_COOKIE[$cookieName])) {
                        // Then expire it with 20 minutes past
-                       $this->addCookie($cookieName, '', FALSE, (time() - 1200));
+                       $this->addCookie($cookieName, '', false, (time() - 1200));
 
                        // Remove it from array
                        unset($_COOKIE[$cookieName]);
@@ -241,7 +234,7 @@ class ImageResponse extends BaseResponse implements Responseable {
                // Only update existing cookies
                if (isset($_COOKIE[$cookieName])) {
                        // Update the cookie
-                       $this->addCookie($cookieName, $_COOKIE[$cookieName], FALSE);
+                       $this->addCookie($cookieName, $_COOKIE[$cookieName], false);
                } // END - if
        }