/**
  * 
  * @param array $data
  * @param bool $gzip, if set to null, then use auto
  * @return \ORC\API\Interior\Server\Response
  */
 protected function send(array $data, $gzip = null)
 {
     if ($gzip === null) {
         $gzip = (bool) $this->getRequest()->get('gzip');
     }
     $response = new Response();
     $response->setData($data);
     $response->setGzip($gzip);
     return $response;
 }
 public function sendContent(Response $response)
 {
     //clear the exiting content
     while (@ob_end_clean()) {
     }
     if ($response->getGzip()) {
         $output = gzcompress($response->getContent());
     } else {
         $output = $response->getContent();
     }
     echo $output;
     exit;
 }