/** * Before running this task, register its rollback and completion * handlers on its collection. The reason this class exists is to * defer registration of rollback and completion tasks until 'run()' time. * * @return \Robo\Result */ public function run() { if ($this->rollbackTask) { $this->collection->registerRollback($this->rollbackTask); } if ($this->task instanceof RollbackInterface) { $this->collection->registerRollback(new CallableTask([$this->task, 'rollback'], $this->task)); } if ($this->task instanceof CompletionInterface) { $this->collection->registerCompletion(new CallableTask([$this->task, 'complete'], $this->task)); } return $this->task->run(); }
/** * If there is a single task, run it; if there is a collection, run * all of its tasks. * * @return \Robo\Result */ protected function runTasks() { if (!$this->collection && $this->currentTask) { return $this->currentTask->run(); } return $this->getCollection()->run(); }
/** * @param \Robo\Result|\Robo\Contract\TaskInterface $result * @param \Consolidation\AnnotatedCommand\CommandData $commandData * * @return null|\Robo\Result */ public function process($result, CommandData $commandData) { if ($result instanceof TaskInterface) { try { return $result->run(); } catch (\Exception $e) { return Result::fromException($result, $e); } } }
/** * @param TaskInterface|NestedCollectionInterface|WrappedTaskInterface $task * * @return \Robo\Result */ protected function runSubtask($task) { $original = $task instanceof WrappedTaskInterface ? $task->original() : $task; $this->setParentCollectionForTask($original, $this->getParentCollection()); if ($original instanceof InflectionInterface) { $original->inflect($this); } $taskResult = $task->run(); return $taskResult; }
/** * @param TaskInterface $task * * @return Result */ private function runSilently(TaskInterface $task) { $this->suppressOutput(); $result = $task->run(); $this->restoreOutput(); return $result; }