Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2321491

Browse files
committed
[Console] simplify the implementation of SymfonyStyle::comment()
1 parent 6ea3999 commit 2321491

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

src/Symfony/Component/Console/Style/SymfonyStyle.php

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,14 @@ public function __construct(InputInterface $input, OutputInterface $output)
6363
* @param string|null $style The style to apply to the whole block
6464
* @param string $prefix The prefix for the block
6565
* @param bool $padding Whether to add vertical padding
66+
* @param bool $escape Whether to escape the message
6667
*/
67-
public function block($messages, $type = null, $style = null, $prefix = ' ', $padding = false)
68+
public function block($messages, $type = null, $style = null, $prefix = ' ', $padding = false, $escape = true)
6869
{
6970
$messages = is_array($messages) ? array_values($messages) : array($messages);
7071

7172
$this->autoPrependBlock();
72-
$this->writeln($this->createBlock($messages, $type, $style, $prefix, $padding, true));
73+
$this->writeln($this->createBlock($messages, $type, $style, $prefix, $padding, $escape));
7374
$this->newLine();
7475
}
7576

@@ -133,11 +134,7 @@ public function text($message)
133134
*/
134135
public function comment($message)
135136
{
136-
$messages = is_array($message) ? array_values($message) : array($message);
137-
138-
$this->autoPrependBlock();
139-
$this->writeln($this->createBlock($messages, null, null, '<fg=default;bg=default> // </>'));
140-
$this->newLine();
137+
$this->block($message, null, null, '<fg=default;bg=default> // </>', false, false);
141138
}
142139

143140
/**

0 commit comments

Comments
 (0)