protected function Twitter::parse_response in Twitter 6.3
Same name and namespace in other branches
- 6.5 twitter.lib.php \Twitter::parse_response()
- 7.6 twitter.lib.php \Twitter::parse_response()
- 7.3 twitter.lib.php \Twitter::parse_response()
- 7.5 twitter.lib.php \Twitter::parse_response()
2 calls to Twitter::parse_response()
- Twitter::call in ./
twitter.lib.php - Calls a twitter api resource
- Twitter::request in ./
twitter.lib.php - Perform a request
File
- ./
twitter.lib.php, line 310 - Classes to implement the full Twitter API
Class
- Primary Twitter API implementation class Supports the full REST API for twitter.
Code
protected function parse_response($response, $format = NULL) {
if (empty($format)) {
$format = $this->format;
}
switch ($format) {
case 'json':
$response_decoded = json_decode($response, TRUE);
if (isset($response_decoded['id_str'])) {
// if we're getting a single object back as JSON
$response_decoded['id'] = $response_decoded['id_str'];
}
else {
// if we're getting an array of objects back as JSON
foreach ($response_decoded as &$item) {
$item['id'] = $item['id_str'];
}
}
return $response_decoded;
}
}