/**
  * Renders a template as a response.
  *
  * @param string
  * @param array
  * @param integer
  * @param array
  */
 public function __construct($file, $varibales = array(), $status = 200, $headers = array())
 {
     $path = $this->file_path($file);
     ob_start();
     extract($varibales);
     require $path;
     $data = ob_get_contents();
     ob_end_clean();
     return parent::__construct($data, $status, $headers);
 }
 /**
  * Builds redirect response.
  *
  * @param string
  * @param integer
  * @param array
  */
 public function __construct($url, $status = 302, $headers = array())
 {
     $headers[] = 'Location: ' . $url;
     return parent::__construct(null, $status, $headers);
 }
 /**
  * Builds a json response.
  *
  * @param mixed
  * @param integer
  * @param array
  */
 public function __construct($data = null, $status = 200, $headers = array())
 {
     $headers[] = 'Content-Type: application/json';
     $data = json_encode($data);
     return parent::__construct($data, $status, $headers);
 }