Remove product literal strings in "pht()", part 18
[phabricator.git] / src / applications / differential / conduit / DifferentialCloseConduitAPIMethod.php
blob12ecda12629c8abdb9bc64f2200a4eeeb7d02c37
1 <?php
3 final class DifferentialCloseConduitAPIMethod
4 extends DifferentialConduitAPIMethod {
6 public function getAPIMethodName() {
7 return 'differential.close';
10 public function getMethodDescription() {
11 return pht('Close a Differential revision.');
14 public function getMethodStatus() {
15 return self::METHOD_STATUS_FROZEN;
18 public function getMethodStatusDescription() {
19 return pht(
20 'This method is frozen and will eventually be deprecated. New code '.
21 'should use "differential.revision.edit" instead.');
24 protected function defineParamTypes() {
25 return array(
26 'revisionID' => 'required int',
30 protected function defineReturnType() {
31 return 'void';
34 protected function defineErrorTypes() {
35 return array(
36 'ERR_NOT_FOUND' => pht('Revision was not found.'),
40 protected function execute(ConduitAPIRequest $request) {
41 $viewer = $request->getUser();
42 $id = $request->getValue('revisionID');
44 $revision = id(new DifferentialRevisionQuery())
45 ->withIDs(array($id))
46 ->setViewer($viewer)
47 ->needReviewers(true)
48 ->executeOne();
49 if (!$revision) {
50 throw new ConduitException('ERR_NOT_FOUND');
53 $xactions = array();
54 $xactions[] = id(new DifferentialTransaction())
55 ->setTransactionType(
56 DifferentialRevisionCloseTransaction::TRANSACTIONTYPE)
57 ->setNewValue(true);
59 $content_source = $request->newContentSource();
61 $editor = id(new DifferentialTransactionEditor())
62 ->setActor($viewer)
63 ->setContentSource($request->newContentSource())
64 ->setContinueOnMissingFields(true)
65 ->setContinueOnNoEffect(true);
67 $editor->applyTransactions($revision, $xactions);
69 return;