5 * Contains \Drupal\Console\Core\Command\CheckCommand.
8 namespace Drupal\Console\Core\Command;
10 use Symfony\Component\Console\Input\InputInterface;
11 use Symfony\Component\Console\Output\OutputInterface;
12 use Drupal\Console\Core\Utils\ConfigurationManager;
13 use Drupal\Console\Core\Utils\RequirementChecker;
14 use Drupal\Console\Core\Utils\ChainQueue;
19 * @package Drupal\Console\Core\Command
21 class CheckCommand extends Command
24 * @var RequirementChecker
26 protected $requirementChecker;
31 protected $chainQueue;
34 * @var ConfigurationManager
36 protected $configurationManager;
39 * CheckCommand constructor.
41 * @param RequirementChecker $requirementChecker
42 * @param ChainQueue $chainQueue
43 * @param ConfigurationManager $configurationManager
45 public function __construct(
46 RequirementChecker $requirementChecker,
47 ChainQueue $chainQueue,
48 ConfigurationManager $configurationManager
50 $this->requirementChecker = $requirementChecker;
51 $this->chainQueue = $chainQueue;
52 $this->configurationManager = $configurationManager;
54 parent::__construct();
60 protected function configure()
64 ->setDescription($this->trans('commands.check.description'));
70 protected function execute(InputInterface $input, OutputInterface $output)
72 $checks = $this->requirementChecker->getCheckResult();
74 $phpCheckFile = $this->configurationManager
75 ->getVendorCoreDirectory() . 'phpcheck.yml';
77 $checks = $this->requirementChecker->validate($phpCheckFile);
80 if (!$checks['php']['valid']) {
81 $this->getIo()->error(
83 $this->trans('commands.check.messages.php-invalid'),
84 $checks['php']['current'],
85 $checks['php']['required']
92 if ($extensions = $checks['extensions']['required']['missing']) {
93 foreach ($extensions as $extension) {
94 $this->getIo()->error(
96 $this->trans('commands.check.messages.extension-missing'),
103 if ($extensions = $checks['extensions']['recommended']['missing']) {
104 foreach ($extensions as $extension) {
105 $this->getIo()->commentBlock(
108 'commands.check.messages.extension-recommended'
116 if ($configurations = $checks['configurations']['required']['missing']) {
117 foreach ($configurations as $configuration) {
118 $this->getIo()->error(
120 $this->trans('commands.check.messages.configuration-missing'),
127 if ($configurations = $checks['configurations']['required']['overwritten']) {
128 foreach ($configurations as $configuration => $overwritten) {
129 $this->getIo()->commentBlock(
132 'commands.check.messages.configuration-overwritten'
141 if ($this->requirementChecker->isValid() && !$this->requirementChecker->isOverwritten()) {
142 $this->getIo()->success(
143 $this->trans('commands.check.messages.success')
147 return $this->requirementChecker->isValid();