Includes ProcessedMetrics and Metrics.
public static getMetricsForTable ( |
||
$dataTable | ||
$report | ||
$baseType | string | The base type each metric class needs to be of. |
return |
/** * @param DataTable $dataTable * @param Report $report * @return Metric[] */ private function getMetricsToFormat(DataTable $dataTable, Report $report = null) { return Report::getMetricsForTable($dataTable, $report, $baseType = 'Piwik\\Plugin\\Metric'); }
private function addVisualizationInfoFromMetricMetadata() { $dataTable = $this->dataTable instanceof DataTable\Map ? $this->dataTable->getFirstRow() : $this->dataTable; $metrics = Report::getMetricsForTable($dataTable, $this->report); // TODO: instead of iterating & calling translate everywhere, maybe we can get all translated names in one place. // may be difficult, though, since translated metrics are specific to the report. foreach ($metrics as $metric) { $name = $metric->getName(); if (empty($this->config->translations[$name])) { $this->config->translations[$name] = $metric->getTranslatedName(); } if (empty($this->config->metrics_documentation[$name])) { $this->config->metrics_documentation[$name] = $metric->getDocumentation(); } } }