/** * Call method to find a matching parameter to return * * @param $name String name of function called * @return String * @throws Exception if not a valid parameter, or not a 'get' function */ public function __call($name, $parameters) { if (!preg_match('/^get/', $name)) { throw new Exception('No such function "' . $name . '"'); } $name = preg_replace('/^get/', '', $name); $property_key = Uni_Core_Gapi::array_key_exists_nc($name, $this->properties); if ($property_key) { return $this->properties[$property_key]; } throw new Exception('No valid property called "' . $name . '"'); }
/** * Call method to find a matching metric or dimension to return * * @param $name String name of function called * @return String * @throws Exception if not a valid metric or dimensions, or not a 'get' function */ public function __call($name, $parameters) { if (!preg_match('/^get/', $name)) { throw new Exception('No such function "' . $name . '"'); } $name = preg_replace('/^get/', '', $name); $metric_key = Uni_Core_Gapi::array_key_exists_nc($name, $this->metrics); if ($metric_key) { return $this->metrics[$metric_key]; } $dimension_key = Uni_Core_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 . '"'); }