1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-29 02:02:41 +01:00
phorge-phorge/src/applications/slowvote/conduit/SlowvoteInfoConduitAPIMethod.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

47 lines
1.1 KiB
PHP

<?php
final class SlowvoteInfoConduitAPIMethod extends SlowvoteConduitAPIMethod {
public function getAPIMethodName() {
return 'slowvote.info';
}
public function getMethodDescription() {
return pht('Retrieve an array of information about a poll.');
}
protected function defineParamTypes() {
return array(
'poll_id' => 'required id',
);
}
protected function defineReturnType() {
return 'nonempty dict';
}
protected function defineErrorTypes() {
return array(
'ERR_BAD_POLL' => pht('No such poll exists.'),
);
}
protected function execute(ConduitAPIRequest $request) {
$poll_id = $request->getValue('poll_id');
$poll = id(new PhabricatorSlowvotePoll())->load($poll_id);
if (!$poll) {
throw new ConduitException('ERR_BAD_POLL');
}
$result = array(
'id' => $poll->getID(),
'phid' => $poll->getPHID(),
'authorPHID' => $poll->getAuthorPHID(),
'question' => $poll->getQuestion(),
'uri' => PhabricatorEnv::getProductionURI('/V'.$poll->getID()),
);
return $result;
}
}