Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Steur <thomas.steur@gmail.com>2015-03-05 04:20:05 +0300
committerThomas Steur <thomas.steur@gmail.com>2015-03-05 05:31:19 +0300
commitec4ded41c8df059d8f3817552e8c1738e7633771 (patch)
tree6cf8a37785851dea7062feca4f1e919274698ddc /plugins
parentd30c78b8f46946e6f071b0547c638601bc78c7ab (diff)
forgot to commit this file, it brings callable columns back to rows
Diffstat (limited to 'plugins')
-rw-r--r--plugins/CoreHome/Columns/Metrics/CallableProcessedMetric.php47
1 files changed, 47 insertions, 0 deletions
diff --git a/plugins/CoreHome/Columns/Metrics/CallableProcessedMetric.php b/plugins/CoreHome/Columns/Metrics/CallableProcessedMetric.php
new file mode 100644
index 0000000000..646c48e862
--- /dev/null
+++ b/plugins/CoreHome/Columns/Metrics/CallableProcessedMetric.php
@@ -0,0 +1,47 @@
+<?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\Plugins\CoreHome\Columns\Metrics;
+
+use Piwik\DataTable\Row;
+use Piwik\Plugin\ProcessedMetric;
+
+class CallableProcessedMetric extends ProcessedMetric
+{
+ private $name;
+ private $callback;
+ private $dependentMetrics;
+
+ public function __construct($name, $callback, $dependentMetrics = array())
+ {
+ $this->name = $name;
+ $this->callback = $callback;
+ $this->dependentMetrics = $dependentMetrics;
+ }
+
+ public function getName()
+ {
+ return $this->name;
+ }
+
+ public function compute(Row $row)
+ {
+ if ($this->callback) {
+ return call_user_func($this->callback, $row);
+ }
+ }
+
+ public function getTranslatedName()
+ {
+ return '';
+ }
+
+ public function getDependentMetrics()
+ {
+ return $this->dependentMetrics;
+ }
+} \ No newline at end of file