src/Runner.php
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);
    }
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);
    }
Dispatches an event.

@param string                $eventName
@param null|TaskInterface    $task
@param null|PayloadInterface $payload
@param null|int              $exitCode
@param null|\Exception       $exception

@return null