Пример #1
0
 /**
  * Quick output of data to avoid several accessor calls if the response is very basic.
  * Can be called statically to allow simple output of basic data.
  * The status code is required, but the other parameters are optional
  * If an error occurs, the LSL-friendly error message is output to the HTTP response, and the script terminated
  *
  * @param int $status_code The status code for the response (required)
  * @param string $status_descriptor The status descriptor for the response (optional - ignored if null)
  * @param mixed $data The data for the response, which can be a scalar, or a mixed array of scalars/scalar-arrays (see {@link SloodleResponse::$data}) (optional - ignored if null)
  * @param bool $static If true (default), then this function will assume it is being call statically, and construct its own response object. Otherwise, it will all the existing member data to render the output.
  * @return void
  * @access public
  */
 function quick_output($status_code, $status_descriptor = null, $data = null, $static = true)
 {
     // Is this s static call?
     if ($static) {
         // Construct and render the output of a response object
         $response = new SloodleResponse($status_code, $status_descriptor, $data);
         $response->render_to_output();
     } else {
         // Set all our data
         $this->status_code = $status_code;
         if ($status_descriptor != null) {
             $this->status_descriptor = $status_descriptor;
         }
         if ($data != null) {
             $this->add_data_line($data);
         }
         // Output it
         $this->render_to_output();
     }
 }