/** * @param $output * @param string $files * @param string $headerKey * @param string $pathKey * @param string $path+ */ private function showFiles($output, $files, $headerKey, $pathKey, $path) { if (!$files) { return; } $this->showMessage($output, $this->translator->trans($headerKey)); $output->writeln(sprintf('<info>%s:</info> <comment>%s</comment>', $this->translator->trans($pathKey), $path)); $index = 1; foreach ($files as $file) { $this->showFile($output, $file, $index); ++$index; } }
use Drupal\AppConsole\Command\Helper\MessageHelper; use Drupal\AppConsole\Command\Helper\ChainCommandHelper; use Drupal\AppConsole\EventSubscriber\CallCommandListener; use Drupal\AppConsole\EventSubscriber\ShowCompletedMessageListener; use Drupal\AppConsole\EventSubscriber\ValidateDependenciesListener; set_time_limit(0); $consoleRoot = __DIR__ . '/../'; if (file_exists($consoleRoot . '/vendor/autoload.php')) { require_once $consoleRoot . '/vendor/autoload.php'; } elseif (file_exists($consoleRoot . '/../../autoload.php')) { require_once $consoleRoot . '/../../autoload.php'; } else { echo 'Something goes wrong with your archive' . PHP_EOL . 'Try downloading again' . PHP_EOL; exit(1); } $config = new UserConfig(); $translatorHelper = new TranslatorHelper(); $translatorHelper->loadResource($config->get('application.language'), $consoleRoot); $application = new Application($config, $translatorHelper); $application->setDirectoryRoot($consoleRoot); $helpers = ['kernel' => new KernelHelper(), 'shell' => new ShellHelper(new Shell($application)), 'dialog' => new DialogHelper(), 'register_commands' => new RegisterCommandsHelper($application), 'stringUtils' => new StringUtils(), 'validators' => new Validators(), 'translator' => $translatorHelper, 'drupal-autoload' => new DrupalAutoloadHelper(), 'message' => new MessageHelper($translatorHelper), 'chain' => new ChainCommandHelper()]; $application->addHelpers($helpers); $dispatcher = new EventDispatcher(); $dispatcher->addSubscriber(new ValidateDependenciesListener()); $dispatcher->addSubscriber(new ShowWelcomeMessageListener()); $dispatcher->addSubscriber(new ShowGeneratedFilesListener()); $dispatcher->addSubscriber(new CallCommandListener()); $dispatcher->addSubscriber(new ShowCompletedMessageListener()); $application->setDispatcher($dispatcher); $application->setDefaultCommand('list'); $application->run();