Remove all "FileHasObject" edge reads and writes
[phabricator.git] / src / applications / maniphest / command / ManiphestStatusEmailCommand.php
blob0387cae34e5ed5f1666c884d600353f441574c67
1 <?php
3 final class ManiphestStatusEmailCommand
4 extends ManiphestEmailCommand {
6 public function getCommand() {
7 return 'status';
10 public function getCommandSyntax() {
11 return '**!status** //status//';
14 public function getCommandSummary() {
15 return pht('Change the status of a task.');
18 public function getCommandDescription() {
19 $names = ManiphestTaskStatus::getTaskStatusMap();
20 $keywords = ManiphestTaskStatus::getTaskStatusKeywordsMap();
22 $table = array();
23 $table[] = '| '.pht('Status').' | '.pht('Keywords');
24 $table[] = '|---|---|';
25 foreach ($keywords as $status => $words) {
26 if (ManiphestTaskStatus::isDisabledStatus($status)) {
27 continue;
30 $words = implode(', ', $words);
31 $table[] = '| '.$names[$status].' | '.$words;
33 $table = implode("\n", $table);
35 return pht(
36 "To change the status of a task, specify the desired status, like ".
37 "`%s`. This table shows the configured names for statuses.\n\n%s\n\n".
38 "If you specify an invalid status, the command is ignored. This ".
39 "command has no effect if you do not specify a status.\n\n".
40 "To quickly close a task, see `%s`.",
41 '!status invalid',
42 $table,
43 '!close');
46 public function buildTransactions(
47 PhabricatorUser $viewer,
48 PhabricatorApplicationTransactionInterface $object,
49 PhabricatorMetaMTAReceivedMail $mail,
50 $command,
51 array $argv) {
52 $xactions = array();
54 $target = phutil_utf8_strtolower(head($argv));
55 $status = null;
57 $keywords = ManiphestTaskStatus::getTaskStatusKeywordsMap();
58 foreach ($keywords as $key => $words) {
59 foreach ($words as $word) {
60 if ($word == $target) {
61 $status = $key;
62 break;
67 if ($status === null) {
68 return array();
71 if (ManiphestTaskStatus::isDisabledStatus($status)) {
72 return array();
75 $xactions[] = $object->getApplicationTransactionTemplate()
76 ->setTransactionType(ManiphestTaskStatusTransaction::TRANSACTIONTYPE)
77 ->setNewValue($status);
79 return $xactions;