Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15413717
D13588.id32841.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D13588.id32841.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D13588: Add filter method to PhutilClassMapQuery
Attached
Detach File
Event Timeline
Log In to Comment