Changeset View
Changeset View
Standalone View
Standalone View
src/configuration/ArcanistConfiguration.php
Show All 32 Lines | public function buildWorkflow($command) { | ||||
return idx($this->buildAllWorkflows(), $command); | return idx($this->buildAllWorkflows(), $command); | ||||
} | } | ||||
public function buildAllWorkflows() { | public function buildAllWorkflows() { | ||||
$workflows_by_name = array(); | $workflows_by_name = array(); | ||||
$workflows_by_class_name = id(new PhutilSymbolLoader()) | $workflows_by_class_name = id(new PhutilSymbolLoader()) | ||||
->setAncestorClass('ArcanistBaseWorkflow') | ->setAncestorClass('ArcanistWorkflow') | ||||
->loadObjects(); | ->loadObjects(); | ||||
foreach ($workflows_by_class_name as $class => $workflow) { | foreach ($workflows_by_class_name as $class => $workflow) { | ||||
$name = $workflow->getWorkflowName(); | $name = $workflow->getWorkflowName(); | ||||
if (isset($workflows_by_name[$name])) { | if (isset($workflows_by_name[$name])) { | ||||
$other = get_class($workflows_by_name[$name]); | $other = get_class($workflows_by_name[$name]); | ||||
throw new Exception( | throw new Exception( | ||||
"Workflows {$class} and {$other} both implement workflows named ". | "Workflows {$class} and {$other} both implement workflows named ". | ||||
"{$name}."); | "{$name}."); | ||||
} | } | ||||
$workflows_by_name[$name] = $workflow; | $workflows_by_name[$name] = $workflow; | ||||
} | } | ||||
return $workflows_by_name; | return $workflows_by_name; | ||||
} | } | ||||
final public function isValidWorkflow($workflow) { | final public function isValidWorkflow($workflow) { | ||||
return (bool)$this->buildWorkflow($workflow); | return (bool)$this->buildWorkflow($workflow); | ||||
} | } | ||||
public function willRunWorkflow($command, ArcanistBaseWorkflow $workflow) { | public function willRunWorkflow($command, ArcanistWorkflow $workflow) { | ||||
// This is a hook. | // This is a hook. | ||||
} | } | ||||
public function didRunWorkflow( | public function didRunWorkflow($command, ArcanistWorkflow $workflow, $err) { | ||||
$command, | |||||
ArcanistBaseWorkflow $workflow, | |||||
$err) { | |||||
// This is a hook. | // This is a hook. | ||||
} | } | ||||
public function didAbortWorkflow($command, $workflow, Exception $ex) { | public function didAbortWorkflow($command, $workflow, Exception $ex) { | ||||
// This is a hook. | // This is a hook. | ||||
} | } | ||||
▲ Show 20 Lines • Show All 192 Lines • Show Last 20 Lines |