<?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
/**
* 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();
* @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
} // 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
* @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
} // 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');
* already sent with an exception
* @return void
*/
- public function flushBuffer ($force = FALSE) {
+ public function flushBuffer ($force = false) {
// Finish the image
$this->getImageInstance()->finishImage();
// 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]);
// 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
}