* A class for an HTTP response on an HTTP request
*
* @author Roland Haeder <webmaster@ship-simu.org>
- * @version 0.3.0
+ * @version 0.0.0
* @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
- * @link http://www.mxchange.org
+ * @link http://www.ship-simu.org
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
*/
private $responseBody = "";
+ /**
+ * Instance of the template engine
+ */
+ private $templateEngine = null;
+
/**
* Protected constructor
*
/**
* Creates an object of this class
*
+ * @param $appInstance An instance of a manageable application
* @return $responseInstance A prepared instance of this class
*/
- public final static function createHttpResponse () {
+ public final static function createHttpResponse (ManageableApplication $appInstance) {
// Get a new instance
$responseInstance = new HttpResponse();
+ // Initialize the template engine here
+ $responseInstance->initTemplateEngine($appInstance);
+
// Return the prepared instance
return $responseInstance;
}
* @throws ResponseHeadersAlreadySentException Thrown if headers are
* already sent
*/
- public function flushResponse($force=false) {
+ public function flushResponse ($force=false) {
if ((headers_sent()) && (!$force)) {
// Headers are already sent!
throw new ResponseHeadersAlreadySentException($this, self::EXCEPTION_HEADERS_ALREADY_SENT);
$this->reponseBody = "";
$this->responseHeaders = array();
}
+
+ /**
+ * Initializes the template engine instance
+ *
+ * @param $appInstance An instance of a manageable application
+ * @return void
+ */
+ public final function initTemplateEngine (ManageableApplication $appInstance) {
+ $this->templateEngine = $this->prepareTemplateEngine($appInstance);
+ }
+
+ /**
+ * Getter for the template engine instance
+ *
+ * @return $templateEngine An instance of the used template engine
+ */
+ public final function getTemplateEngine () {
+ return $this->templateEngine;
+ }
}
// [EOF]