diff options
author | diosmosis <benaka@piwik.pro> | 2014-11-02 11:14:21 +0300 |
---|---|---|
committer | diosmosis <benaka@piwik.pro> | 2014-11-07 04:46:07 +0300 |
commit | b082b508a9232a1c9f6e55831fbb67d2643e6efa (patch) | |
tree | 27e550bacb8996fdbde084537ec5904e3c2f7a24 /core/Plugin/ProcessedMetric.php | |
parent | abeb75a282ada95f6088cf7aa2a98a3f084a365d (diff) |
[poc] moved BounceRate calculation to ProcessedMetric class.
Diffstat (limited to 'core/Plugin/ProcessedMetric.php')
-rw-r--r-- | core/Plugin/ProcessedMetric.php | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/core/Plugin/ProcessedMetric.php b/core/Plugin/ProcessedMetric.php new file mode 100644 index 0000000000..a6b88f6c0d --- /dev/null +++ b/core/Plugin/ProcessedMetric.php @@ -0,0 +1,56 @@ +<?php +/** + * Piwik - free/libre analytics platform + * + * @link http://piwik.org + * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later + */ +namespace Piwik\Plugin; + +use Piwik\DataTable\Row; + +/** + * TODO + */ +abstract class ProcessedMetric +{ + /** + * The sub-namespace name in a plugin where Report components are stored. + */ + const COMPONENT_SUBNAMESPACE = 'Metrics'; + + /** + * TODO + * + * @return ProcessedMetric[] + */ + public static function getAll() + { + $components = Manager::getInstance()->findMultipleComponents(self::COMPONENT_SUBNAMESPACE, __CLASS__); + + $result = array(); + foreach ($components as $componentClass) { + /** @var ProcessedMetric $component */ + $component = new $componentClass(); + + $name = $component->getName(); + $result[$name] = $component; + } + return $result; + } + + /** + * TODO + */ + abstract public function getName(); + + /** + * TODO + */ + abstract public function format($value); + + /** + * TODO + */ + abstract public function compute(Row $row); +}
\ No newline at end of file |