Page MenuHomePhabricator

D13588.id32841.diff
No OneTemporary

D13588.id32841.diff

diff --git a/src/symbols/PhutilClassMapQuery.php b/src/symbols/PhutilClassMapQuery.php
--- a/src/symbols/PhutilClassMapQuery.php
+++ b/src/symbols/PhutilClassMapQuery.php
@@ -41,6 +41,7 @@
private $ancestorClass;
private $expandMethod;
+ private $filterMethod;
private $filterNull = false;
private $uniqueMethod;
private $sortMethod;
@@ -148,6 +149,19 @@
}
+ /**
+ * Provide a method to filter the map.
+ *
+ * @param string Name of the filtering method.
+ * @return this
+ * @task config
+ */
+ public function setFilterMethod($filter_method) {
+ $this->filterMethod = $filter_method;
+ return $this;
+ }
+
+
/* -( Executing the Query )------------------------------------------------ */
@@ -191,6 +205,7 @@
}
$expand = $this->expandMethod;
+ $filter = $this->filterMethod;
$unique = $this->uniqueMethod;
$sort = $this->sortMethod;
@@ -253,6 +268,11 @@
$map = $list;
}
+ // Apply the "filter" mechanism, if it is configured.
+ if (strlen($filter)) {
+ $map = mfilter($map, $filter);
+ }
+
// Apply the "sort" mechanism, if it is configured.
if (strlen($sort)) {
$map = msort($map, $sort);

File Metadata

Mime Type
text/plain
Expires
Thu, Mar 20, 8:50 PM (3 w, 2 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7367909
Default Alt Text
D13588.id32841.diff (1 KB)

Event Timeline