Piwik\Archive::getNumeric PHP Method

getNumeric() public method

If multiple sites were requested in {@link build()} or {@link factory()} the result will be indexed by site ID. If multiple periods were requested in {@link build()} or {@link factory()} the result will be indexed by period. The site ID index is always first, so if multiple sites & periods were requested, the result will be indexed by site ID first, then period.
public getNumeric ( string | array $names ) : false | integer | array
$names string | array One or more archive names, eg, `'nb_visits'`, `'Referrers_distinctKeywords'`, etc.
return false | integer | array `false` if there is no data to return, a single numeric value if we're not querying for multiple sites/periods, or an array if multiple sites, periods or names are queried for.
    public function getNumeric($names)
    {
        $data = $this->get($names, 'numeric');
        $resultIndices = $this->getResultIndices();
        $result = $data->getIndexedArray($resultIndices);
        // if only one metric is returned, just return it as a numeric value
        if (empty($resultIndices) && count($result) <= 1 && (!is_array($names) || count($names) == 1)) {
            $result = (double) reset($result);
            // convert to float in case $result is empty
        }
        return $result;
    }