X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;ds=sidebyside;f=vendor%2Fdrupal%2Fconsole-core%2Fsrc%2FEventSubscriber%2FShowGenerateCountCodeLinesListener.php;fp=vendor%2Fdrupal%2Fconsole-core%2Fsrc%2FEventSubscriber%2FShowGenerateCountCodeLinesListener.php;h=a8650e2d619249afd76c9283f91e67df3577ace8;hb=9917807b03b64faf00f6a1f29dcb6eafc454efa5;hp=0000000000000000000000000000000000000000;hpb=aea91e65e895364e460983b890e295aa5d5540a5;p=yaffs-website diff --git a/vendor/drupal/console-core/src/EventSubscriber/ShowGenerateCountCodeLinesListener.php b/vendor/drupal/console-core/src/EventSubscriber/ShowGenerateCountCodeLinesListener.php new file mode 100644 index 000000000..a8650e2d6 --- /dev/null +++ b/vendor/drupal/console-core/src/EventSubscriber/ShowGenerateCountCodeLinesListener.php @@ -0,0 +1,81 @@ +translator = $translator; + $this->countCodeLines = $countCodeLines; + } + + /** + * @param ConsoleTerminateEvent $event + */ + public function showGenerateCountCodeLines(ConsoleTerminateEvent $event) + { + if ($event->getExitCode() != 0) { + return; + } + + /* @var DrupalStyle $io */ + $io = new DrupalStyle($event->getInput(), $event->getOutput()); + + $countCodeLines = $this->countCodeLines->getCountCodeLines(); + if ($countCodeLines > 0) { + $io->commentBlock( + sprintf( + $this->translator->trans('application.messages.lines-code'), + $countCodeLines + ) + ); + } + } + + /** + * @{@inheritdoc} + */ + public static function getSubscribedEvents() + { + return [ConsoleEvents::TERMINATE => 'showGenerateCountCodeLines']; + } +}