예제 #1
0
 /**
  * Returns a numeric value from the API.
  * Works only for API methods that originally returns numeric values (there is no cast here)
  *
  * @param string             $methodToCall  Name of method to call, eg. Referers.getNumberOfDistinctSearchEngines
  * @param bool|string        $date          A custom date to use when getting the value. If false, the 'date' query
  *                                          parameter is used.
  *
  * @return int|float
  */
 protected function getNumericValue($methodToCall, $date = false)
 {
     $params = $date === false ? array() : array('date' => $date);
     $return = Piwik_API_Request::processRequest($methodToCall, $params);
     $columns = $return->getFirstRow()->getColumns();
     return reset($columns);
 }