Example #1
0
 /**
  * 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();
 }