Remove product literal strings in "pht()", part 25
[phabricator.git] / src / applications / releeph / conduit / ReleephQueryBranchesConduitAPIMethod.php
blob400bbee604298a9e7ddd5f4d38de0c796faa019e
1 <?php
3 final class ReleephQueryBranchesConduitAPIMethod
4 extends ReleephConduitAPIMethod {
6 public function getAPIMethodName() {
7 return 'releeph.querybranches';
10 public function getMethodDescription() {
11 return pht('Query information about Releeph branches.');
14 protected function defineParamTypes() {
15 return array(
16 'ids' => 'optional list<id>',
17 'phids' => 'optional list<phid>',
18 'productPHIDs' => 'optional list<phid>',
19 ) + $this->getPagerParamTypes();
22 protected function defineReturnType() {
23 return 'query-results';
26 protected function execute(ConduitAPIRequest $request) {
27 $viewer = $request->getUser();
29 $query = id(new ReleephBranchQuery())
30 ->setViewer($viewer);
32 $ids = $request->getValue('ids');
33 if ($ids !== null) {
34 $query->withIDs($ids);
37 $phids = $request->getValue('phids');
38 if ($phids !== null) {
39 $query->withPHIDs($phids);
42 $product_phids = $request->getValue('productPHIDs');
43 if ($product_phids !== null) {
44 $query->withProductPHIDs($product_phids);
47 $pager = $this->newPager($request);
48 $branches = $query->executeWithCursorPager($pager);
50 $data = array();
51 foreach ($branches as $branch) {
52 $id = $branch->getID();
54 $uri = '/releeph/branch/'.$id.'/';
55 $uri = PhabricatorEnv::getProductionURI($uri);
57 $data[] = array(
58 'id' => $id,
59 'phid' => $branch->getPHID(),
60 'uri' => $uri,
61 'name' => $branch->getName(),
62 'productPHID' => $branch->getProduct()->getPHID(),
66 return $this->addPagerResults(
67 array(
68 'data' => $data,
70 $pager);