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
21 * @package Drupal\Console\Core\EventSubscriber
23 class ShowGeneratedFilesListener implements EventSubscriberInterface
36 * ShowGeneratedFilesListener constructor.
38 * @param FileQueue $fileQueue
39 * @param ShowFile $showFile
41 public function __construct(FileQueue $fileQueue, ShowFile $showFile)
43 $this->fileQueue = $fileQueue;
44 $this->showFile = $showFile;
48 * @param ConsoleTerminateEvent $event
50 public function showGeneratedFiles(ConsoleTerminateEvent $event)
52 /* @var Command $command */
53 $command = $event->getCommand();
54 /* @var DrupalStyle $io */
55 $io = new DrupalStyle($event->getInput(), $event->getOutput());
57 if ($event->getExitCode() != 0) {
61 if ('self-update' == $command->getName()) {
65 $files = $this->fileQueue->getFiles();
67 $this->showFile->generatedFiles($io, $files, false);
74 public static function getSubscribedEvents()
76 return [ConsoleEvents::TERMINATE => 'showGeneratedFiles'];