/** * Dispatches an event. * * @param string $eventName * @param null|TaskInterface $task * @param null|PayloadInterface $payload * @param null|int $exitCode * @param null|\Exception $exception * * @return null */ private function dispatch($eventName, TaskInterface $task = null, PayloadInterface $payload = null, $exitCode = null, \Exception $exception = null) { \Assert\that($eventName)->string()->notEmpty(); $event = new Event(); $event->setRunner($this); if ($task) { $event->setTask($task); } if ($payload) { $event->setPayload($payload); } if (!is_null($exitCode)) { $event->setExitCode($exitCode); } if ($exception) { $event->setException($exception); } $this->logger->debug(sprintf("Dispatching event '%s'", $eventName)); $this->eventDispatcher->dispatch($eventName, $event); }
/** * Prints task skip information. * * @param Event $event * * @return null */ public function onTaskSkip(Event $event) { /** @var AbstractTask $task */ $task = $event->getTask(); if ($event->getTask() instanceof RemoteTask) { /** @var RemoteTask $task */ $this->outputHandler->write(sprintf("|-- <warning>Skipping Task '%s', Server '%s' because of skip()</warning>", $task->getName(), $task->getServer()->getName())); } else { /** @var LocalTask $task */ $this->outputHandler->write(sprintf("|-- <warning>Skipping Task '%s' because of skip()</warning>", $task->getName())); } }