diff --git a/src/BBRouter/Response.php b/src/BBRouter/Response.php deleted file mode 100755 index 2118b08..0000000 --- a/src/BBRouter/Response.php +++ /dev/null @@ -1,133 +0,0 @@ -_headers[$key] = $value; - return $istance; - } - - public static function body_prepend($body = null){ - $instance = self::getInstance(); - if (null !== $body) { - $instance->_body = (string) $body . $instance->_body; - return $instance; - } - return $instance; - } - - public static function body($body = null){ - $instance = self::getInstance(); - if (null !== $body) { - $instance->_body = (string) $body; - return $instance; - } - return $instance; - } - - public static function body_append($body = null){ - $instance = self::getInstance(); - if (null !== $body) { - $instance->_body .= (string) $body; - return $instance; - } - return $instance; - } - - private function send_headers(){ - foreach ($this->_headers as $key => $value) { - header($key .': '. $value, false); - } - return $this; - } - - private function send_body(){ - echo (string) $this->_body; - return $this; - } - - public static function send(){ - $instance = self::getInstance(); - $instance->send_headers(); - $instance->send_body(); - return $instance; - } - - public static function json($object, $jsonp_prefix = null){ - $instance = self::getInstance(); - - $instance->body(''); - - $json = json_encode($object); - if (null !== $jsonp_prefix) { - // Should ideally be application/json-p once adopted - $instance->header('Content-Type', 'text/javascript'); - $instance->body("$jsonp_prefix($json);"); - } else { - $instance->header('Content-Type', 'application/json'); - $instance->body($json); - } - $instance->send(); - return $instance; - } - - public static function redirect($url, $code = 302){ - $instance = self::getInstance(); - - $instance->_code = $code; - $instance->header('Location', $url); - - $instance->body(''); - $instance->send(); - - return $instance; - } - - function done(){ - die; - } -}