original_string: public function encodeOutput($data)
      {
          // TODO - use HTTP_ACCEPT here ?
          //var_dump($_SERVER['HTTP_ACCEPT']);
  
          if ($_GET['format'] == 'xml') {
              throw $this->exception('only JSON format is supported', null, 406);
          }
  
          if ($_GET['format'] == 'json_pretty') {
              header('Content-type: application/json');
              echo json_encode($data, JSON_PRETTY_PRINT);
              return;
          }
  
          if ($_GET['format'] == 'html') {
              echo '<pre>';
              echo json_encode($data, JSON_PRETTY_PRINT);
              return;
          }
  
          header('Content-type: application/json');
  
          if ($data === null) {
              $data = array();
          }
          echo json_encode($data);
      }
code: public function encodeOutput($data)
      {
          // TODO - use HTTP_ACCEPT here ?
          //var_dump($_SERVER['HTTP_ACCEPT']);
  
          if ($_GET['format'] == 'xml') {
              throw $this->exception('only JSON format is supported', null, 406);
          }
  
          if ($_GET['format'] == 'json_pretty') {
              header('Content-type: application/json');
              echo json_encode($data, JSON_PRETTY_PRINT);
              return;
          }
  
          if ($_GET['format'] == 'html') {
              echo '<pre>';
              echo json_encode($data, JSON_PRETTY_PRINT);
              return;
          }
  
          header('Content-type: application/json');
  
          if ($data === null) {
              $data = array();
          }
          echo json_encode($data);
      }
code_tokens: public function encodeOutput ( $ data ) { // TODO - use HTTP_ACCEPT here ? //var_dump($_SERVER['HTTP_ACCEPT']); if ( $ _GET [ 'format' ] == 'xml' ) { throw $ this -> exception ( 'only JSON format is supported' , null , 406 ) ; } if ( $ _GET [ 'format' ] == 'json_pretty' ) { header ( 'Content-type: application/json' ) ; echo json_encode ( $ data , JSON_PRETTY_PRINT ) ; return ; } if ( $ _GET [ 'format' ] == 'html' ) { echo '<pre>' ; echo json_encode ( $ data , JSON_PRETTY_PRINT ) ; return ; } header ( 'Content-type: application/json' ) ; if ( $ data === null ) { $ data = array ( ) ; } echo json_encode ( $ data ) ; }
docstring: Output will be properly fromatted.
  
  @param mixed $data
docstring_tokens: Output will be properly fromatted .