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:
Diffstat (limited to 'core/DataTable/Filter/PrependSegment.php')
-rw-r--r--core/DataTable/Filter/PrependSegment.php34
1 files changed, 34 insertions, 0 deletions
diff --git a/core/DataTable/Filter/PrependSegment.php b/core/DataTable/Filter/PrependSegment.php
new file mode 100644
index 0000000000..34d14e6f0a
--- /dev/null
+++ b/core/DataTable/Filter/PrependSegment.php
@@ -0,0 +1,34 @@
+<?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\DataTable\Filter;
+
+use Piwik\DataTable;
+
+/**
+ * Executes a callback for each row of a {@link DataTable} and prepends each existing segment with the
+ * given segment.
+ *
+ * **Basic usage example**
+ *
+ * $dataTable->filter('PrependSegment', array('segmentName==segmentValue;'));
+ *
+ * @api
+ */
+class PrependSegment extends PrependValueToMetadata
+{
+ /**
+ * @param DataTable $table
+ * @param string $prependSegment The segment to prepend if a segment is already defined. Make sure to include
+ * A condition, eg the segment should end with ';' or ','
+ */
+ public function __construct($table, $prependSegment = '')
+ {
+ parent::__construct($table, 'segment', $prependSegment);
+ }
+}