/**
  * 
  * @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;
 }
예제 #2
0
 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;
 }