templateCollection = $newsletterCollectionFactory; } /** * @inheritdoc */ protected function configure() { $this->setName('dev:email:newsletter-compatibility-check') ->setDescription('Scans newsletter templates for potential variable usage compatibility issues'); } /** * Executes compatibility checker command * * @param InputInterface $input * @param OutputInterface $output * @return int|null */ protected function execute(InputInterface $input, OutputInterface $output) { $collection = $this->templateCollection->create(); $collection->load(); $this->hasErrors = false; foreach ($collection as $template) { $this->checkTemplate($template, $output); } if (!$this->hasErrors) { $output->writeln('No errors detected'); } return $this->hasErrors ? Cli::RETURN_FAILURE : Cli::RETURN_SUCCESS; } }