5 * Contains \Drupal\Console\Core\Bootstrap.
8 namespace Drupal\Console\Core\Bootstrap;
10 use Drupal\Console\Core\Utils\DrupalFinder;
11 use Symfony\Component\DependencyInjection\ContainerBuilder;
12 use Symfony\Component\Config\FileLocator;
13 use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
16 * Class DrupalConsoleCore
18 * @package Drupal\Console\Core\Bootstrap
20 class DrupalConsoleCore
35 protected $drupalFinder;
38 * DrupalConsole constructor.
41 * @param string $appRoot
42 * @param DrupalFinder $drupalFinder
44 public function __construct(
47 DrupalFinder $drupalFinder
50 $this->appRoot = $appRoot;
51 $this->drupalFinder = $drupalFinder;
55 * @return ContainerBuilder
57 public function boot()
59 $container = new ContainerBuilder();
60 $loader = new YamlFileLoader($container, new FileLocator($this->root));
62 if (substr($this->root, -1) === DIRECTORY_SEPARATOR) {
63 $this->root = substr($this->root, 0, -1);
67 $this->root.DRUPAL_CONSOLE_CORE.'services.yml',
68 $this->root.'/services.yml',
69 $this->root.DRUPAL_CONSOLE.'uninstall.services.yml',
70 $this->root.DRUPAL_CONSOLE.'extend.console.uninstall.services.yml'
73 foreach ($servicesFiles as $servicesFile) {
74 if (file_exists($servicesFile)) {
75 $loader->load($servicesFile);
79 $container->get('console.configuration_manager')
80 ->loadConfiguration($this->root)
83 $container->get('console.translator_manager')
84 ->loadCoreLanguage('en', $this->root);
86 $appRoot = $this->appRoot?$this->appRoot:$this->root;
91 $consoleRoot = $appRoot;
92 if (stripos($this->root, '/bin/') <= 0) {
93 $consoleRoot = $this->root;
101 'console.drupal_finder',
105 $configurationManager = $container->get('console.configuration_manager');
106 $directory = $configurationManager->getConsoleDirectory() . 'extend/';
107 $autoloadFile = $directory . 'vendor/autoload.php';
108 if (is_file($autoloadFile)) {
109 include_once $autoloadFile;
110 $extendServicesFile = $directory . 'extend.console.uninstall.services.yml';
111 if (is_file($extendServicesFile)) {
112 $loader->load($extendServicesFile);
116 $container->get('console.renderer')
119 $this->root.'/templates/',
120 $this->root.DRUPAL_CONSOLE_CORE.'/templates/'