1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-30 02:32:41 +01:00
phorge-arcanist/src/workflow/ArcanistStartWorkflow.php
Jakub Vrana d0353d2381 Fix errors found by PHPStan
Test Plan:
Ran `phpstan analyze -a autoload.php arcanist/src` with `autoload.php` containing:

  <?php
  require_once 'libphutil/src/__phutil_library_init__.php';
  require_once 'arcanist/src/__phutil_library_init__.php';

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin

Differential Revision: https://secure.phabricator.com/D17367
2017-02-16 13:54:43 +00:00

82 lines
1.7 KiB
PHP

<?php
/**
* Start time tracking on an object.
*/
final class ArcanistStartWorkflow extends ArcanistPhrequentWorkflow {
public function getWorkflowName() {
return 'start';
}
public function getCommandSynopses() {
return phutil_console_format(<<<EOTEXT
**start** __object__
EOTEXT
);
}
public function getCommandHelp() {
return phutil_console_format(<<<EOTEXT
Start tracking work in Phrequent.
EOTEXT
);
}
public function requiresConduit() {
return true;
}
public function requiresAuthentication() {
return true;
}
public function getArguments() {
return array(
'*' => 'name',
);
}
public function run() {
$conduit = $this->getConduit();
$started_phids = array();
$short_name = $this->getArgument('name');
foreach ($short_name as $object_name) {
$object_lookup = $conduit->callMethodSynchronous(
'phid.lookup',
array(
'names' => array($object_name),
));
if (!array_key_exists($object_name, $object_lookup)) {
echo phutil_console_format(
"%s\n",
pht("No such object '%s' found.", $object_name));
return 1;
}
$object_phid = $object_lookup[$object_name]['phid'];
$started_phids[] = $conduit->callMethodSynchronous(
'phrequent.push',
array(
'objectPHID' => $object_phid,
));
}
$phid_query = $conduit->callMethodSynchronous(
'phid.query',
array(
'phids' => $started_phids,
));
echo phutil_console_format(
"%s: %s\n\n",
pht('Started'),
implode(', ', ipull($phid_query, 'fullName')));
$this->printCurrentTracking();
}
}