Correct Aphlict websocket URI construction after PHP8 compatibility changes
[phabricator.git] / src / applications / packages / query / PhabricatorPackagesPublisherSearchEngine.php
blobbe7b83f5fc268080f36718ae8f0ca471e87c60c7
1 <?php
3 final class PhabricatorPackagesPublisherSearchEngine
4 extends PhabricatorApplicationSearchEngine {
6 public function getResultTypeDescription() {
7 return pht('Package Publishers');
10 public function getApplicationClassName() {
11 return 'PhabricatorPackagesApplication';
14 public function newQuery() {
15 return id(new PhabricatorPackagesPublisherQuery());
18 public function canUseInPanelContext() {
19 return false;
22 protected function buildQueryFromParameters(array $map) {
23 $query = $this->newQuery();
25 if ($map['match'] !== null) {
26 $query->withNameNgrams($map['match']);
29 return $query;
32 protected function buildCustomSearchFields() {
33 return array(
34 id(new PhabricatorSearchTextField())
35 ->setLabel(pht('Name Contains'))
36 ->setKey('match')
37 ->setDescription(pht('Search for publishers by name substring.')),
41 protected function getURI($path) {
42 return '/packages/publisher/'.$path;
45 protected function getBuiltinQueryNames() {
46 $names = array(
47 'all' => pht('All Publishers'),
50 return $names;
53 public function buildSavedQueryFromBuiltin($query_key) {
54 $query = $this->newSavedQuery();
55 $query->setQueryKey($query_key);
57 switch ($query_key) {
58 case 'all':
59 return $query;
62 return parent::buildSavedQueryFromBuiltin($query_key);
65 protected function renderResultList(
66 array $publishers,
67 PhabricatorSavedQuery $query,
68 array $handles) {
70 assert_instances_of($publishers, 'PhabricatorPackagesPublisher');
72 $viewer = $this->requireViewer();
74 $list = id(new PhabricatorPackagesPublisherListView())
75 ->setViewer($viewer)
76 ->setPublishers($publishers)
77 ->newListView();
79 return id(new PhabricatorApplicationSearchResultView())
80 ->setObjectList($list)
81 ->setNoDataString(pht('No publishers found.'));