Skip to content

[Console] simplify the implementation of SymfonyStyle::comment() #21664

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 19, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions src/Symfony/Component/Console/Style/SymfonyStyle.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,14 @@ public function __construct(InputInterface $input, OutputInterface $output)
* @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();
}

Expand Down Expand Up @@ -133,11 +134,7 @@ public function text($message)
*/
public function comment($message)
{
$messages = is_array($message) ? array_values($message) : array($message);

$this->autoPrependBlock();
$this->writeln($this->createBlock($messages, null, null, '<fg=default;bg=default> // </>'));
$this->newLine();
$this->block($message, null, null, '<fg=default;bg=default> // </>', false, false);
}

/**
Expand Down