Correct Aphlict websocket URI construction after PHP8 compatibility changes
[phabricator.git] / src / infrastructure / customfield / datasource / PhabricatorCustomFieldApplicationSearchNoneFunctionDatasource.php
blob7302da318107f0d80cd1de5a5dcf70f1f66b1c52
1 <?php
3 final class PhabricatorCustomFieldApplicationSearchNoneFunctionDatasource
4 extends PhabricatorTypeaheadDatasource {
6 public function getBrowseTitle() {
7 return pht('Browse No Value');
10 public function getPlaceholderText() {
11 return pht('Type "none()"...');
14 public function getDatasourceApplicationClass() {
15 return null;
18 public function getDatasourceFunctions() {
19 return array(
20 'none' => array(
21 'name' => pht('No Value'),
22 'summary' => pht('Find results with no value.'),
23 'description' => pht(
24 "This function includes results which have no value. Use a query ".
25 "like this to find results with no value:\n\n%s\n\n".
26 'If you combine this function with other constraints, results '.
27 'which have no value or the specified values will be returned.',
28 '> any()'),
33 public function loadResults() {
34 $results = array(
35 $this->newNoneFunction(),
37 return $this->filterResultsAgainstTokens($results);
40 protected function evaluateFunction($function, array $argv_list) {
41 $results = array();
43 foreach ($argv_list as $argv) {
44 $results[] = new PhabricatorQueryConstraint(
45 PhabricatorQueryConstraint::OPERATOR_NULL,
46 null);
49 return $results;
52 public function renderFunctionTokens($function, array $argv_list) {
53 $results = array();
54 foreach ($argv_list as $argv) {
55 $results[] = PhabricatorTypeaheadTokenView::newFromTypeaheadResult(
56 $this->newNoneFunction());
58 return $results;
61 private function newNoneFunction() {
62 $name = pht('No Value');
63 return $this->newFunctionResult()
64 ->setName($name.' none')
65 ->setDisplayName($name)
66 ->setIcon('fa-ban')
67 ->setPHID('none()')
68 ->setUnique(true)
69 ->addAttribute(pht('Select results with no value.'));