1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-02-12 14:58:33 +01:00
phorge-phorge/src/applications/releeph/conduit/ReleephGetBranchesConduitAPIMethod.php
Joshua Spence 36e2d02d6e phtize all the things
Summary: `pht`ize a whole bunch of strings in rP.

Test Plan: Intense eyeballing.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: hach-que, Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D12797
2015-05-22 21:16:39 +10:00

61 lines
1.5 KiB
PHP

<?php
final class ReleephGetBranchesConduitAPIMethod extends ReleephConduitAPIMethod {
public function getAPIMethodName() {
return 'releeph.getbranches';
}
public function getMethodDescription() {
return pht('Return information about all active Releeph branches.');
}
protected function defineParamTypes() {
return array(
);
}
protected function defineReturnType() {
return 'nonempty list<dict<string, wild>>';
}
protected function execute(ConduitAPIRequest $request) {
$results = array();
$projects = id(new ReleephProductQuery())
->setViewer($request->getUser())
->withActive(1)
->execute();
foreach ($projects as $project) {
$repository = $project->getRepository();
$branches = $project->loadRelatives(
id(new ReleephBranch()),
'releephProjectID',
'getID',
'isActive = 1');
foreach ($branches as $branch) {
$full_branch_name = $branch->getName();
$cut_point_commit = $branch->loadOneRelative(
id(new PhabricatorRepositoryCommit()),
'phid',
'getCutPointCommitPHID');
$results[] = array(
'project' => $project->getName(),
'repository' => $repository->getCallsign(),
'branch' => $branch->getBasename(),
'fullBranchName' => $full_branch_name,
'symbolicName' => $branch->getSymbolicName(),
'cutPoint' => $cut_point_commit->getCommitIdentifier(),
);
}
}
return $results;
}
}