getProcessedMetricsById() public méthode

Returns an array mapping the ProcessedMetrics served by this report by their string names.
public getProcessedMetricsById ( ) : Piwik\Plugin\ProcessedMetric[]
Résultat Piwik\Plugin\ProcessedMetric[]
Exemple #1
0
 /**
  * Returns the Metrics that are displayed by a DataTable of a certain Report type.
  *
  * Includes ProcessedMetrics and Metrics.
  *
  * @param DataTable $dataTable
  * @param Report|null $report
  * @param string $baseType The base type each metric class needs to be of.
  * @return Metric[]
  * @api
  */
 public static function getMetricsForTable(DataTable $dataTable, Report $report = null, $baseType = 'Piwik\\Plugin\\Metric')
 {
     $metrics = $dataTable->getMetadata(DataTable::EXTRA_PROCESSED_METRICS_METADATA_NAME) ?: array();
     if (!empty($report)) {
         $metrics = array_merge($metrics, $report->getProcessedMetricsById());
     }
     $result = array();
     /** @var Metric $metric */
     foreach ($metrics as $metric) {
         if (!$metric instanceof $baseType) {
             continue;
         }
         $result[$metric->getName()] = $metric;
     }
     return $result;
 }