예제 #1
0
 /**
  * Call method to find a matching parameter to return
  * @param string $name name of function called
  * @param array $parameters
  * @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 = Connector::array_key_exists_nc($name, $this->properties);
     if ($property_key) {
         return $this->properties[$property_key];
     }
     throw new Exception('No valid property called "' . $name . '"');
 }
예제 #2
0
 /**
  * Call method to find a matching metric or dimension to return
  * @param $name String name of function called
  * @param array $parameters
  * @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 = Connector::array_key_exists_nc($name, $this->metrics);
     if ($metric_key) {
         return $this->metrics[$metric_key];
     }
     $dimension_key = Connector::array_key_exists_nc($name, $this->dimensions);
     if ($dimension_key) {
         return $this->dimensions[$dimension_key];
     }
     throw new Exception('No valid metric or dimension called "' . $name . '"');
 }
예제 #3
0
파일: Connector.php 프로젝트: jakubpas/gapi
 /**
  * Call method to find a matching root parameter or aggregate metric to return
  * @param $name string name of function called
  * @param $parameters
  * @return string
  * @throws Exception if not a valid parameter or aggregate metric, 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);
     $parameter_key = Connector::array_key_exists_nc($name, $this->report_root_parameters);
     if ($parameter_key) {
         return $this->report_root_parameters[$parameter_key];
     }
     $aggregate_metric_key = Connector::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 . '"');
 }