Changeset View
Changeset View
Standalone View
Standalone View
src/toolset/ArcanistWorkflow.php
| <?php | <?php | ||||
| abstract class ArcanistWorkflow extends Phobject { | abstract class ArcanistWorkflow extends Phobject { | ||||
| private $runtime; | private $runtime; | ||||
| private $toolset; | private $toolset; | ||||
| private $arguments; | private $arguments; | ||||
| private $configurationEngine; | private $configurationEngine; | ||||
| private $configurationSourceList; | private $configurationSourceList; | ||||
| private $conduitEngine; | |||||
| /** | /** | ||||
| * Return the command used to invoke this workflow from the command like, | * Return the command used to invoke this workflow from the command like, | ||||
| * e.g. "help" for @{class:ArcanistHelpWorkflow}. | * e.g. "help" for @{class:ArcanistHelpWorkflow}. | ||||
| * | * | ||||
| * @return string The command a user types to invoke this workflow. | * @return string The command a user types to invoke this workflow. | ||||
| */ | */ | ||||
| abstract public function getWorkflowName(); | abstract public function getWorkflowName(); | ||||
| Show All 25 Lines | protected function getWorkflowArguments() { | ||||
| return array(); | return array(); | ||||
| } | } | ||||
| protected function getWorkflowInformation() { | protected function getWorkflowInformation() { | ||||
| // TOOLSETS: Temporary! | // TOOLSETS: Temporary! | ||||
| return null; | return null; | ||||
| } | } | ||||
| public function newPhutilWorkflow() { | public function newPhutilWorkflow() { | ||||
| $arguments = $this->getWorkflowArguments(); | $arguments = $this->getWorkflowArguments(); | ||||
| assert_instances_of($arguments, 'ArcanistWorkflowArgument'); | assert_instances_of($arguments, 'ArcanistWorkflowArgument'); | ||||
| $specs = mpull($arguments, 'getPhutilSpecification'); | $specs = mpull($arguments, 'getPhutilSpecification'); | ||||
| $phutil_workflow = id(new ArcanistPhutilWorkflow()) | $phutil_workflow = id(new ArcanistPhutilWorkflow()) | ||||
| ->setName($this->getWorkflowName()) | ->setName($this->getWorkflowName()) | ||||
| ▲ Show 20 Lines • Show All 99 Lines • ▼ Show 20 Lines | final protected function newWorkflowArgument($key) { | ||||
| return id(new ArcanistWorkflowArgument()) | return id(new ArcanistWorkflowArgument()) | ||||
| ->setKey($key); | ->setKey($key); | ||||
| } | } | ||||
| final protected function newWorkflowInformation() { | final protected function newWorkflowInformation() { | ||||
| return new ArcanistWorkflowInformation(); | return new ArcanistWorkflowInformation(); | ||||
| } | } | ||||
| final protected function getConduitEngine() { | |||||
| if (!$this->conduitEngine) { | |||||
| $conduit_uri = $this->getConfig('phabricator.uri'); | |||||
| if (!strlen($conduit_uri)) { | |||||
| throw new ArcanistNoURIConduitException( | |||||
| pht( | |||||
| 'This workflow is trying to connect to the Phabricator API, but '. | |||||
| 'no Phabricator URI is configured. Run "arc help connect" for '. | |||||
| 'guidance.')); | |||||
| } | |||||
| $conduit_engine = id(new ArcanistConduitEngine()) | |||||
| ->setConduitURI($conduit_uri); | |||||
| $this->conduitEngine = $conduit_engine; | |||||
| } | |||||
| return $this->conduitEngine; | |||||
| } | |||||
| } | } | ||||