setContainer($container); $this->response = $container->get('response'); $this->redirectResponse = NULL; } /** * Send output to client */ public function __destruct() { if ( ! $this->hasRendered) { $this->send(); } } /** * Return rendered output * * @return string */ public function __toString() { $this->hasRendered = TRUE; return $this->getOutput(); } /** * Set the output string * * @param string $string * @return View */ public function setOutput($string) { $this->response->getBody()->write($string); return $this; } /** * Append additional output * * @param string $string * @return View */ public function appendOutput($string) { return $this->setOutput($string); } /** * Get the current output string * * @return string */ public function getOutput() { return $this->response->getBody()->__toString(); } /** * Send output to client * * @return void */ abstract public function send(); } // End of View.php