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/RemoveSubtables.php')
-rw-r--r--core/DataTable/Filter/RemoveSubtables.php47
1 files changed, 47 insertions, 0 deletions
diff --git a/core/DataTable/Filter/RemoveSubtables.php b/core/DataTable/Filter/RemoveSubtables.php
new file mode 100644
index 0000000000..e84244119c
--- /dev/null
+++ b/core/DataTable/Filter/RemoveSubtables.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\DataTable\Filter;
+
+use Piwik\DataTable;
+use Piwik\DataTable\BaseFilter;
+
+/**
+ * Delete all existing subtables from rows.
+ *
+ * **Basic example usage**
+ *
+ * $dataTable->filter('RemoveSubtables');
+ *
+ * @api
+ */
+class RemoveSubtables extends BaseFilter
+{
+ /**
+ * Constructor.
+ *
+ * @param DataTable $table The DataTable that will be filtered eventually.
+ */
+ public function __construct($table)
+ {
+ parent::__construct($table);
+ }
+
+ /**
+ * See {@link Limit}.
+ *
+ * @param DataTable $table
+ */
+ public function filter($table)
+ {
+ $rows = $table->getRows();
+ foreach ($rows as $row) {
+ $row->removeSubtable();
+ }
+ }
+}