protected function Github_HttpClient::decodeResponse in Bibliography Module 7.2
Get a JSON response and transform it to a PHP array
Return value
array the response
1 call to Github_HttpClient::decodeResponse()
- Github_HttpClient::request in modules/
CiteProc/ Github/ HttpClient.php - Send a request to the server, receive a response, decode the response and returns an associative array
File
- modules/
CiteProc/ Github/ HttpClient.php, line 118
Class
- Github_HttpClient
- Performs requests on GitHub API. API documentation should be self-explanatory.
Code
protected function decodeResponse($response, array $options) {
if ('text' === $options['format']) {
return $response;
}
elseif ('json' === $options['format']) {
return json_decode($response, true);
}
throw new Exception(__CLASS__ . ' only supports json & text format, ' . $options['format'] . ' given.');
}