Correct Aphlict websocket URI construction after PHP8 compatibility changes
[phabricator.git] / src / applications / phid / conduit / PHIDLookupConduitAPIMethod.php
blobf70afb9931f98cec1e595df6b98ae0088fb15ffd
1 <?php
3 final class PHIDLookupConduitAPIMethod extends PHIDConduitAPIMethod {
5 public function getAPIMethodName() {
6 return 'phid.lookup';
9 public function getMethodDescription() {
10 return pht('Look up objects by name.');
13 protected function defineParamTypes() {
14 return array(
15 'names' => 'required list<string>',
19 protected function defineReturnType() {
20 return 'nonempty dict<string, wild>';
23 protected function execute(ConduitAPIRequest $request) {
24 $names = $request->getValue('names');
26 $query = id(new PhabricatorObjectQuery())
27 ->setViewer($request->getUser())
28 ->withNames($names);
29 $query->execute();
30 $name_map = $query->getNamedResults();
32 $handles = id(new PhabricatorHandleQuery())
33 ->setViewer($request->getUser())
34 ->withPHIDs(mpull($name_map, 'getPHID'))
35 ->execute();
37 $result = array();
38 foreach ($name_map as $name => $object) {
39 $phid = $object->getPHID();
40 $handle = $handles[$phid];
41 $result[$name] = $this->buildHandleInformationDictionary($handle);
44 return $result;