From 08228d9d9814a9497f4c7f2cdee67dc7d24dda48 Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Sun, 31 Dec 2017 19:10:27 +0100 Subject: [PATCH] Improved and simplified RenameTagCommand thanks to SymfonyStyle --- module/CLI/src/Command/Tag/RenameTagCommand.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/module/CLI/src/Command/Tag/RenameTagCommand.php b/module/CLI/src/Command/Tag/RenameTagCommand.php index a38a8da1..f76c05f2 100644 --- a/module/CLI/src/Command/Tag/RenameTagCommand.php +++ b/module/CLI/src/Command/Tag/RenameTagCommand.php @@ -9,6 +9,7 @@ use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; +use Symfony\Component\Console\Style\SymfonyStyle; use Zend\I18n\Translator\TranslatorInterface; class RenameTagCommand extends Command @@ -42,16 +43,15 @@ class RenameTagCommand extends Command protected function execute(InputInterface $input, OutputInterface $output) { + $io = new SymfonyStyle($input, $output); $oldName = $input->getArgument('oldName'); $newName = $input->getArgument('newName'); try { $this->tagService->renameTag($oldName, $newName); - $output->writeln(sprintf('%s', $this->translator->translate('Tag properly renamed.'))); + $io->success($this->translator->translate('Tag properly renamed.')); } catch (EntityDoesNotExistException $e) { - $output->writeln('' . sprintf($this->translator->translate( - 'A tag with name "%s" was not found' - ), $oldName) . ''); + $io->error(\sprintf($this->translator->translate('A tag with name "%s" was not found'), $oldName)); } } }