Exemplo n.º 1
0
    include_once $consoleRoot . '/../../autoload.php';
} else {
    echo 'Something goes wrong with your archive' . PHP_EOL . 'Try downloading again' . PHP_EOL;
    exit(1);
}
$container = new ContainerBuilder();
$loader = new YamlFileLoader($container, new FileLocator($consoleRoot));
$loader->load('services.yml');
$config = $container->get('config');
$translatorHelper = new TranslatorHelper();
$translatorHelper->loadResource($config->get('application.language'), $consoleRoot);
$helpers = ['nested-array' => new NestedArrayHelper(), 'kernel' => new KernelHelper(), 'string' => new StringHelper(), 'validator' => new ValidatorHelper(), 'translator' => $translatorHelper, 'site' => new SiteHelper(), 'renderer' => new TwigRendererHelper(), 'showFile' => new ShowFileHelper(), 'chain' => new ChainCommandHelper(), 'drupal' => new DrupalHelper(), 'commandDiscovery' => new CommandDiscoveryHelper($config->get('application.develop')), 'remote' => new RemoteHelper(), 'httpClient' => new HttpClientHelper(), 'api' => new DrupalApiHelper(), 'container' => new ContainerHelper($container)];
$application = new Application($helpers);
$application->setDirectoryRoot($consoleRoot);
$dispatcher = new EventDispatcher();
$dispatcher->addSubscriber(new ValidateDependenciesListener());
$dispatcher->addSubscriber(new ShowWelcomeMessageListener());
$dispatcher->addSubscriber(new ShowGenerateDocListener());
$dispatcher->addSubscriber(new DefaultValueEventListener());
$dispatcher->addSubscriber(new ShowGeneratedFilesListener());
$dispatcher->addSubscriber(new CallCommandListener());
$dispatcher->addSubscriber(new ShowGenerateChainListener());
$dispatcher->addSubscriber(new ShowGenerateInlineListener());
$dispatcher->addSubscriber(new ShowTerminateMessageListener());
$application->setDispatcher($dispatcher);
$defaultCommand = 'about';
if ($config->get('application.command') && $application->has($config->get('application.command'))) {
    $defaultCommand = $config->get('application.command');
}
$application->setDefaultCommand($defaultCommand);
$application->run();