public function gapiReportEntry::__call in Google Analytics Statistics 7
Same name and namespace in other branches
- 7.2 includes/gapi.class.php \gapiReportEntry::__call()
- 7.x inc/gapi.class.php \gapiReportEntry::__call()
Call method to find a matching metric or dimension to return
Parameters
$name String name of function called:
Return value
String
Throws
Exception if not a valid metric or dimensions, or not a 'get' function
File
- includes/
gapi.class.php, line 811
Class
- gapiReportEntry
- Class gapiReportEntry
Code
public function __call($name, $parameters) {
if (!preg_match('/^get/', $name)) {
throw new Exception('No such function "' . $name . '"');
}
$name = preg_replace('/^get/', '', $name);
$metric_key = gapi::array_key_exists_nc($name, $this->metrics);
if ($metric_key) {
return $this->metrics[$metric_key];
}
$dimension_key = gapi::array_key_exists_nc($name, $this->dimensions);
if ($dimension_key) {
return $this->dimensions[$dimension_key];
}
throw new Exception('No valid metric or dimesion called "' . $name . '"');
}