5 * Contains \Drupal\Console\Core\EventSubscriber\ShowGeneratedFilesListener.
8 namespace Drupal\Console\Core\EventSubscriber;
10 use Symfony\Component\Console\ConsoleEvents;
11 use Symfony\Component\Console\Event\ConsoleTerminateEvent;
12 use Symfony\Component\EventDispatcher\EventSubscriberInterface;
13 use Symfony\Component\Console\Command\Command;
14 use Drupal\Console\Core\Style\DrupalStyle;
15 use Drupal\Console\Core\Utils\FileQueue;
16 use Drupal\Console\Core\Utils\ShowFile;
19 * Class ShowGeneratedFilesListener
20 * @package Drupal\Console\Core\EventSubscriber
22 class ShowGeneratedFilesListener implements EventSubscriberInterface
35 * ShowGeneratedFilesListener constructor.
36 * @param FileQueue $fileQueue
37 * @param ShowFile $showFile
39 public function __construct(FileQueue $fileQueue, ShowFile $showFile)
41 $this->fileQueue = $fileQueue;
42 $this->showFile = $showFile;
46 * @param ConsoleTerminateEvent $event
48 public function showGeneratedFiles(ConsoleTerminateEvent $event)
50 /* @var Command $command */
51 $command = $event->getCommand();
52 /* @var DrupalStyle $io */
53 $io = new DrupalStyle($event->getInput(), $event->getOutput());
55 if ($event->getExitCode() != 0) {
59 if ('self-update' == $command->getName()) {
63 $files = $this->fileQueue->getFiles();
65 $this->showFile->generatedFiles($io, $files, false);
72 public static function getSubscribedEvents()
74 return [ConsoleEvents::TERMINATE => 'showGeneratedFiles'];