Remove product literal strings in "pht()", part 6
[phabricator.git] / src / applications / differential / command / DifferentialActionEmailCommand.php
blob1b1f8d64e320da3353e6a06e9e4b33771ee15713
1 <?php
3 final class DifferentialActionEmailCommand
4 extends MetaMTAEmailTransactionCommand {
6 private $command;
7 private $action;
8 private $aliases;
9 private $commandSummary;
10 private $commandDescription;
12 public function getCommand() {
13 return $this->command;
16 private function setCommand($command) {
17 $this->command = $command;
18 return $this;
21 private function setAction($action) {
22 $this->action = $action;
23 return $this;
26 private function getAction() {
27 return $this->action;
30 private function setCommandAliases(array $aliases) {
31 $this->aliases = $aliases;
32 return $this;
35 public function getCommandAliases() {
36 return $this->aliases;
39 public function setCommandSummary($command_summary) {
40 $this->commandSummary = $command_summary;
41 return $this;
44 public function getCommandSummary() {
45 return $this->commandSummary;
48 public function setCommandDescription($command_description) {
49 $this->commandDescription = $command_description;
50 return $this;
53 public function getCommandDescription() {
54 return $this->commandDescription;
57 public function getCommandObjects() {
58 $actions = DifferentialRevisionActionTransaction::loadAllActions();
59 $actions = msortv($actions, 'getRevisionActionOrderVector');
61 $objects = array();
62 foreach ($actions as $action) {
63 $keyword = $action->getCommandKeyword();
64 if ($keyword === null) {
65 continue;
68 $aliases = $action->getCommandAliases();
69 $summary = $action->getCommandSummary();
71 $object = id(new self())
72 ->setCommand($keyword)
73 ->setCommandAliases($aliases)
74 ->setAction($action->getTransactionTypeConstant())
75 ->setCommandSummary($summary);
77 $objects[] = $object;
80 return $objects;
83 public function isCommandSupportedForObject(
84 PhabricatorApplicationTransactionInterface $object) {
85 return ($object instanceof DifferentialRevision);
88 public function buildTransactions(
89 PhabricatorUser $viewer,
90 PhabricatorApplicationTransactionInterface $object,
91 PhabricatorMetaMTAReceivedMail $mail,
92 $command,
93 array $argv) {
94 $xactions = array();
96 $xactions[] = $object->getApplicationTransactionTemplate()
97 ->setTransactionType($this->getAction())
98 ->setNewValue(true);
100 return $xactions;