Example #1
0
 /**
  * Creates a new task runner.
  *
  * @param TaskCollection       $collection
  * @param LoggerInterface|null $logger
  *
  * @return TaskRunner
  */
 public function create(TaskCollection $collection, LoggerInterface $logger = null)
 {
     $taskRunner = new TaskRunner();
     $taskRunner->setTaskCollection($collection);
     if ($logger) {
         $taskRunner->setLogger($logger);
     }
     $this->logger->debug('Attaching deployment output handler to events.');
     $taskRunner->on('runner.start', array($this->deploymentOutputHandler, 'onRunnerStart'));
     $taskRunner->on('runner.success', array($this->deploymentOutputHandler, 'onRunnerSuccess'));
     $taskRunner->on('runner.task.start', array($this->deploymentOutputHandler, 'onTaskStart'));
     $taskRunner->on('runner.task.success', array($this->deploymentOutputHandler, 'onTaskSuccess'));
     $taskRunner->on('runner.task.retry', array($this->deploymentOutputHandler, 'onTaskRetry'));
     $taskRunner->on('runner.task.skip', array($this->deploymentOutputHandler, 'onTaskSkip'));
     $taskRunner->on('runner.task.unless', array($this->deploymentOutputHandler, 'onTaskUnless'));
     return $taskRunner;
 }