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.php')
-rw-r--r--core/DataTable.php19
1 files changed, 19 insertions, 0 deletions
diff --git a/core/DataTable.php b/core/DataTable.php
index 62ebc6db18..16a5dbf64f 100644
--- a/core/DataTable.php
+++ b/core/DataTable.php
@@ -1702,6 +1702,25 @@ class DataTable implements DataTableInterface, \IteratorAggregate, \ArrayAccess
}
/**
+ * Deletes a metadata property by name.
+ *
+ * @param bool|string $name The metadata name (omit to delete all metadata)
+ * @return bool True if the requested metadata was deleted
+ */
+ public function deleteMetadata($name = false) : bool
+ {
+ if ($name === false) {
+ $this->metadata = [];
+ return true;
+ }
+ if (!isset($this->metadata[$name])) {
+ return false;
+ }
+ unset($this->metadata[$name]);
+ return true;
+ }
+
+ /**
* Returns all table metadata.
*
* @return array