private function initEventDispatcher(
        OutputInterface $output,
        string $formatterName,
        bool $verbose
    ): EventDispatcherInterface {
        if ('dot' === $formatterName) {
            $formatter = new DotFormatter($output);
        } elseif ('pretty' === $formatterName) {
            $formatter = new PrettyFormatter($output, $verbose);
        } elseif ('simple' === $formatterName) {
            $formatter = new SimpleFormatter();
        } else {
            throw new \RuntimeException(
                sprintf('Format "%s" is unknown. Available formats: %s.', $formatterName, implode(', ', $this->formats))
            );
        }

        $eventDispatcher = new EventDispatcher();
        $eventDispatcher->addSubscriber($formatter);

        return $eventDispatcher;
    }