Remove product literal strings in "pht()", part 25
[phabricator.git] / src / applications / releeph / conduit / ReleephGetBranchesConduitAPIMethod.php
blob5516b4edb61e1957fff870869d51b033822ab124
1 <?php
3 final class ReleephGetBranchesConduitAPIMethod extends ReleephConduitAPIMethod {
5 public function getAPIMethodName() {
6 return 'releeph.getbranches';
9 public function getMethodDescription() {
10 return pht('Return information about all active Releeph branches.');
13 protected function defineParamTypes() {
14 return array(
18 protected function defineReturnType() {
19 return 'nonempty list<dict<string, wild>>';
22 protected function execute(ConduitAPIRequest $request) {
23 $results = array();
25 $projects = id(new ReleephProductQuery())
26 ->setViewer($request->getUser())
27 ->withActive(1)
28 ->execute();
30 foreach ($projects as $project) {
31 $repository = $project->getRepository();
33 $branches = id(new ReleephBranch())->loadAllWhere(
34 'releephProjectID = %d AND isActive = 1',
35 $project->getID());
37 foreach ($branches as $branch) {
38 $full_branch_name = $branch->getName();
40 $cut_point_commit = id(new PhabricatorRepositoryCommit())->loadOneWhere(
41 'phid = %s',
42 $branch->getCutPointCommitPHID());
44 $results[] = array(
45 'project' => $project->getName(),
46 'repository' => $repository->getCallsign(),
47 'branch' => $branch->getBasename(),
48 'fullBranchName' => $full_branch_name,
49 'symbolicName' => $branch->getSymbolicName(),
50 'cutPoint' => $cut_point_commit->getCommitIdentifier(),
55 return $results;