public function notify(\Exception $exception) { if (!$exception instanceof ServiceNotFoundException) { return; } $serviceId = $exception->getId(); $guessedFqcn = $this->guessFqcn($serviceId); $definition = new Definition(); $definition->setClass($guessedFqcn); $containerBuilder = new ContainerBuilder(); $containerBuilder->addDefinitions([$serviceId => $definition]); $dumper = new YamlDumper($containerBuilder); $result = $dumper->dump(); $message = sprintf('Service `%s` missing. Define it in your services.yml:', $serviceId); $this->output->writeln('--- ' . $message . PHP_EOL); $this->output->write($result, true); $errorMessages = ['Service ' . $serviceId . ' was not found.']; $formatter = new FormatterHelper(); $formattedBlock = $formatter->formatBlock($errorMessages, 'error', true); $this->output->writeln(''); $this->output->writeln($formattedBlock); $this->output->writeln(''); $question = sprintf('<question>Do you want to create a specification for %s? (Y/n)</question>', $guessedFqcn); $dialog = new DialogHelper(); if ($dialog->askConfirmation($this->output, $question, true)) { $this->specRunner->runDescCommand($guessedFqcn); } }
public function runDescCommand($className) { $this->descRunner->runDescCommand($className); }