refactoring the response class.
This commit is contained in:
parent
60c317caba
commit
48120ce403
|
@ -121,10 +121,7 @@ public static function error($code, $data = array())
|
||||||
*/
|
*/
|
||||||
public static function prepare($response)
|
public static function prepare($response)
|
||||||
{
|
{
|
||||||
if ($response instanceof Redirect)
|
if ($response instanceof Redirect) $response = $response->response;
|
||||||
{
|
|
||||||
$response = $response->response;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ( ! $response instanceof Response) ? new static($response) : $response;
|
return ( ! $response instanceof Response) ? new static($response) : $response;
|
||||||
}
|
}
|
||||||
|
@ -136,15 +133,9 @@ public static function prepare($response)
|
||||||
*/
|
*/
|
||||||
public function send()
|
public function send()
|
||||||
{
|
{
|
||||||
if ( ! array_key_exists('Content-Type', $this->headers))
|
if ( ! array_key_exists('Content-Type', $this->headers)) $this->header('Content-Type', 'text/html; charset=utf-8')
|
||||||
{
|
|
||||||
$this->header('Content-Type', 'text/html; charset=utf-8');
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( ! headers_sent())
|
if ( ! headers_sent()) $this->send_headers();
|
||||||
{
|
|
||||||
$this->send_headers();
|
|
||||||
}
|
|
||||||
|
|
||||||
echo (string) $this->content;
|
echo (string) $this->content;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue