protected function sendResponse($response, $http_code = 200)
    {
        $http_code = min(max($http_code, 100), 505);
        http_response_code($http_code);
        header('Content-type: application/json');
        echo json_encode($response);
    }
protected function sendResponse($response, $http_code = 200)
    {
        $http_code = min(max($http_code, 100), 505);
        http_response_code($http_code);
        header('Content-type: application/json');
        echo json_encode($response);
    }
protected function sendResponse ( $ response , $ http_code = 200 ) { $ http_code = min ( max ( $ http_code , 100 ) , 505 ) ; http_response_code ( $ http_code ) ; header ( 'Content-type: application/json' ) ; echo json_encode ( $ response ) ; }
Output the response as JSON with HTTP headers

@param array|object $response
@param int $http_code
Output the response as JSON with HTTP headers