diff options
author | diosmosis <benaka@piwik.pro> | 2014-11-08 08:36:20 +0300 |
---|---|---|
committer | diosmosis <benaka@piwik.pro> | 2014-11-08 08:36:20 +0300 |
commit | bc5a8e3ee9fed5a1e50c024feb1f3f415f3dc699 (patch) | |
tree | a14d43451d8fd3a7c2852ac61159ac47f83efc77 /core/Plugin/ProcessedMetric.php | |
parent | 41f6d051a3c6a4083a807acdea4e681a02f8f9cb (diff) |
Document ProcessedMetric class.
Diffstat (limited to 'core/Plugin/ProcessedMetric.php')
-rw-r--r-- | core/Plugin/ProcessedMetric.php | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/core/Plugin/ProcessedMetric.php b/core/Plugin/ProcessedMetric.php index f70cc915d3..b2d563f633 100644 --- a/core/Plugin/ProcessedMetric.php +++ b/core/Plugin/ProcessedMetric.php @@ -11,7 +11,10 @@ use Piwik\DataTable; use Piwik\DataTable\Row; /** - * TODO + * Base type for processed metrics. A processed metric is a metric that is computed using + * one or more other metrics. + * + * @api */ abstract class ProcessedMetric extends Metric { @@ -21,17 +24,31 @@ abstract class ProcessedMetric extends Metric const COMPONENT_SUBNAMESPACE = 'Metrics'; /** - * TODO + * Computes the metric using the values in a {@link Piwik\DataTable\Row}. + * + * The computed value should be numerical and not formatted in any way. For example, for + * a percent value, `0.14` should be returned instead of `"14%"`. + * + * @return mixed */ abstract public function compute(Row $row); /** - * TODO + * Returns the array of metrics that are necessary for computing this metric. The elements + * of the array are metric names. + * + * @return string[] */ abstract public function getDependenctMetrics(); /** - * TODO + * Executed before computing all processed metrics for a report. Implementers can return `false` + * to skip computing this metric. + * + * @param Report $report + * @param DataTable $table + * @return bool Return `true` to compute the metric for the table, `false` to skip computing + * this metric. */ public function beforeCompute(Report $report, DataTable $table) { |