setContainer($container); $this->response = $container->get('response'); } /** * Send output to client */ public function __destruct() { if ( ! $this->hasRendered) { $this->send(); } } /** * @inheritdoc */ public function __toString() { if ($this->hasRendered) { throw new DoubleRenderException(); } $this->hasRendered = TRUE; return $this->getOutput(); } /** * @inheritdoc */ public function setOutput($string) { $this->response->getBody()->write($string); return $this; } /** * @inheritdoc */ public function appendOutput($string) { return $this->setOutput($string); } /** * @inheritdoc */ public function getOutput() { return $this->response->getBody()->__toString(); } } // End of View.php