function GenerateCommandTrait::writeMessages
Writes the messages that the plugin has set, and clears them.
They are progress reports rather than data, so they go to stderr.
1 call to GenerateCommandTrait::writeMessages()
- GenerateCommandTrait::generate in devel_generate/
src/ Command/ GenerateCommandTrait.php - Generates with the given plugin, from the command's arguments and options.
File
-
devel_generate/
src/ Command/ GenerateCommandTrait.php, line 90
Class
- GenerateCommandTrait
- Runs a DevelGenerate plugin from a console command.
Namespace
Drupal\devel_generate\CommandCode
protected function writeMessages(InputInterface $input, OutputInterface $output) : void {
$io = (new SymfonyStyle($input, $output))->getErrorStyle();
foreach ($this->messenger
->deleteAll() as $type => $messages) {
foreach ($messages as $message) {
$message = trim(html_entity_decode(strip_tags((string) $message), ENT_QUOTES | ENT_HTML5));
match ($type) { MessengerInterface::TYPE_ERROR => $io->error($message),
MessengerInterface::TYPE_WARNING => $io->warning($message),
default => $io->writeln($message),
};
}
}
}