public function gapi::__call in Google Analytics Statistics 7
Same name and namespace in other branches
- 7.2 includes/gapi.class.php \gapi::__call()
- 7.x inc/gapi.class.php \gapi::__call()
Call method to find a matching root parameter or aggregate metric to return
Parameters
$name String name of function called:
Return value
String
Throws
Exception if not a valid parameter or aggregate metric, or not a 'get' function
File
- includes/
gapi.class.php, line 646
Class
- gapi
- GAPI - Google Analytics PHP Interface
Code
public function __call($name, $parameters) {
if (!preg_match('/^get/', $name)) {
throw new Exception('No such function "' . $name . '"');
}
$name = preg_replace('/^get/', '', $name);
$parameter_key = gapi::array_key_exists_nc($name, $this->report_root_parameters);
if ($parameter_key) {
return $this->report_root_parameters[$parameter_key];
}
$aggregate_metric_key = gapi::array_key_exists_nc($name, $this->report_aggregate_metrics);
if ($aggregate_metric_key) {
return $this->report_aggregate_metrics[$aggregate_metric_key];
}
throw new Exception('No valid root parameter or aggregate metric called "' . $name . '"');
}