src/Groundwork/Classes/Response.php
public function send($code, $body = '')
    {
        if (!isset($this->codes[$code])) {
            $statusCode = 500;
            $body = 'API attempted to return an unknown HTTP status.';
        }
        // if the body wasn't defined, default to the inbuilt response
        if (!$body) $body = $this->codes[$code];
        header('HTTP/1.1 ' . $code . ' ' . $this->codes[$code]);
        header('Content-type: application/json');
        echo json_encode($body);
        exit;
    }
public function send($code, $body = '')
    {
        if (!isset($this->codes[$code])) {
            $statusCode = 500;
            $body = 'API attempted to return an unknown HTTP status.';
        }
        // if the body wasn't defined, default to the inbuilt response
        if (!$body) $body = $this->codes[$code];
        header('HTTP/1.1 ' . $code . ' ' . $this->codes[$code]);
        header('Content-type: application/json');
        echo json_encode($body);
        exit;
    }
public function send ( $ code , $ body = '' ) { if ( ! isset ( $ this -> codes [ $ code ] ) ) { $ statusCode = 500 ; $ body = 'API attempted to return an unknown HTTP status.' ; } // if the body wasn't defined, default to the inbuilt response if ( ! $ body ) $ body = $ this -> codes [ $ code ] ; header ( 'HTTP/1.1 ' . $ code . ' ' . $ this -> codes [ $ code ] ) ; header ( 'Content-type: application/json' ) ; echo json_encode ( $ body ) ; exit ; }
Output a JSON formatted response of the supplied body param, along with
the supplied code param as the HTTP status code.

@param int $code
@param mixed $body
Output a JSON formatted response of the supplied body param along with the supplied code param as the HTTP status code .