Correct Aphlict websocket URI construction after PHP8 compatibility changes
[phabricator.git] / src / infrastructure / customfield / datasource / PhabricatorCustomFieldApplicationSearchAnyFunctionDatasource.php
blob31f189988cfeaded5a1039dfbc3a129febf58416
1 <?php
3 final class PhabricatorCustomFieldApplicationSearchAnyFunctionDatasource
4 extends PhabricatorTypeaheadDatasource {
6 public function getBrowseTitle() {
7 return pht('Browse Any');
10 public function getPlaceholderText() {
11 return pht('Type "any()"...');
14 public function getDatasourceApplicationClass() {
15 return null;
18 public function getDatasourceFunctions() {
19 return array(
20 'any' => array(
21 'name' => pht('Any Value'),
22 'summary' => pht('Find results with any value.'),
23 'description' => pht(
24 "This function includes results which have any value. Use a query ".
25 "like this to find results with any value:\n\n%s",
26 '> any()'),
31 public function loadResults() {
32 $results = array(
33 $this->newAnyFunction(),
35 return $this->filterResultsAgainstTokens($results);
38 protected function evaluateFunction($function, array $argv_list) {
39 $results = array();
41 foreach ($argv_list as $argv) {
42 $results[] = new PhabricatorQueryConstraint(
43 PhabricatorQueryConstraint::OPERATOR_ANY,
44 null);
47 return $results;
50 public function renderFunctionTokens($function, array $argv_list) {
51 $results = array();
52 foreach ($argv_list as $argv) {
53 $results[] = PhabricatorTypeaheadTokenView::newFromTypeaheadResult(
54 $this->newAnyFunction());
56 return $results;
59 private function newAnyFunction() {
60 $name = pht('Any Value');
61 return $this->newFunctionResult()
62 ->setName($name.' any')
63 ->setDisplayName($name)
64 ->setIcon('fa-circle-o')
65 ->setPHID('any()')
66 ->setUnique(true)
67 ->addAttribute(pht('Select results with any value.'));