requirementChecker = $requirementChecker; $this->chainQueue = $chainQueue; $this->configurationManager = $configurationManager; parent::__construct(); } /** * {@inheritdoc} */ protected function configure() { $this ->setName('check') ->setDescription($this->trans('commands.check.description')); } /** * {@inheritdoc} */ protected function execute(InputInterface $input, OutputInterface $output) { $io = new DrupalStyle($input, $output); $checks = $this->requirementChecker->getCheckResult(); if (!$checks) { $phpCheckFile = $this->configurationManager->getHomeDirectory().'/.console/phpcheck.yml'; if (!file_exists($phpCheckFile)) { $phpCheckFile = $this->configurationManager->getApplicationDirectory(). DRUPAL_CONSOLE_CORE. 'config/dist/phpcheck.yml'; } $io->newLine(); $io->info($this->trans('commands.check.messages.file')); $io->comment($phpCheckFile); $checks = $this->requirementChecker->validate($phpCheckFile); } if (!$checks['php']['valid']) { $io->error( sprintf( $this->trans('commands.check.messages.php_invalid'), $checks['php']['current'], $checks['php']['required'] ) ); return 1; } if ($extensions = $checks['extensions']['required']['missing']) { foreach ($extensions as $extension) { $io->error( sprintf( $this->trans('commands.check.messages.extension_missing'), $extension ) ); } } if ($extensions = $checks['extensions']['recommended']['missing']) { foreach ($extensions as $extension) { $io->commentBlock( sprintf( $this->trans( 'commands.check.messages.extension_recommended' ), $extension ) ); } } if ($configurations = $checks['configurations']['required']['missing']) { foreach ($configurations as $configuration) { $io->error( sprintf( $this->trans('commands.check.messages.configuration_missing'), $configuration ) ); } } if ($configurations = $checks['configurations']['required']['overwritten']) { foreach ($configurations as $configuration => $overwritten) { $io->commentBlock( sprintf( $this->trans( 'commands.check.messages.configuration_overwritten' ), $configuration, $overwritten ) ); } } if ($this->requirementChecker->isValid() && !$this->requirementChecker->isOverwritten()) { $io->success( $this->trans('commands.check.messages.success') ); } return $this->requirementChecker->isValid(); } }