protected function gapi::accountObjectMapper in Google Analytics Statistics 7.2
Same name and namespace in other branches
- 7 includes/gapi.class.php \gapi::accountObjectMapper()
- 7.x inc/gapi.class.php \gapi::accountObjectMapper()
Report Account Mapper to convert the JSON to array of useful PHP objects
Parameters
String $json_string:
Return value
Array of gapiAccountEntry objects
1 call to gapi::accountObjectMapper()
- gapi::requestAccountData in includes/
gapi.class.php - Request account data from Google Analytics
File
- includes/
gapi.class.php, line 243
Class
- gapi
- GAPI - Google Analytics PHP Interface
Code
protected function accountObjectMapper($json_string) {
$json = json_decode($json_string, true);
$results = array();
foreach ($json['items'] as $item) {
$properties = array();
foreach ($item['webProperties'] as $property) {
$properties[$property['name']] = $property;
}
$results[] = new gapiAccountEntry($properties);
}
unset($json['items']);
$this->account_root_parameters = $json;
$this->account_entries = $results;
return $results;
}