Commit 45969e35 authored by Taylor Otwell's avatar Taylor Otwell

added render method to response class.

parent 37b5f614
...@@ -214,18 +214,28 @@ class Response { ...@@ -214,18 +214,28 @@ class Response {
// Since this method is used by both the Route and Controller classes, it is // Since this method is used by both the Route and Controller classes, it is
// a convenient spot to cast the application response to a string before it // a convenient spot to cast the application response to a string before it
// is returned to the main request handler. // is returned to the main request handler.
$content =& $response->content; $response->render();
if (is_object($content) and method_exists($content, '__toString')) return $response;
}
/**
* Convert the content of the Response to a string and return it.
*
* @return string
*/
public function render()
{
if (is_object($this->content) and method_exists($this->content, '__toString'))
{ {
$content = $content->__toString(); $this->content = $this->content->__toString();
} }
else else
{ {
$content = (string) $content; $this->content = (string) $this->content;
} }
return $response; return $this->content;
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment