From 2321491d3f8b12dc852182a3b89c9877bd2c6229 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Sat, 18 Feb 2017 09:59:26 -0800 Subject: [PATCH] [Console] simplify the implementation of SymfonyStyle::comment() --- src/Symfony/Component/Console/Style/SymfonyStyle.php | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/Symfony/Component/Console/Style/SymfonyStyle.php b/src/Symfony/Component/Console/Style/SymfonyStyle.php index d9d9794cf2..a867961767 100644 --- a/src/Symfony/Component/Console/Style/SymfonyStyle.php +++ b/src/Symfony/Component/Console/Style/SymfonyStyle.php @@ -63,13 +63,14 @@ class SymfonyStyle extends OutputStyle * @param string|null $style The style to apply to the whole block * @param string $prefix The prefix for the block * @param bool $padding Whether to add vertical padding + * @param bool $escape Whether to escape the message */ - public function block($messages, $type = null, $style = null, $prefix = ' ', $padding = false) + public function block($messages, $type = null, $style = null, $prefix = ' ', $padding = false, $escape = true) { $messages = is_array($messages) ? array_values($messages) : array($messages); $this->autoPrependBlock(); - $this->writeln($this->createBlock($messages, $type, $style, $prefix, $padding, true)); + $this->writeln($this->createBlock($messages, $type, $style, $prefix, $padding, $escape)); $this->newLine(); } @@ -133,11 +134,7 @@ class SymfonyStyle extends OutputStyle */ public function comment($message) { - $messages = is_array($message) ? array_values($message) : array($message); - - $this->autoPrependBlock(); - $this->writeln($this->createBlock($messages, null, null, ' // ')); - $this->newLine(); + $this->block($message, null, null, ' // ', false, false); } /**