Skip to content

Commit 5c51476

Browse files
committed
minor #18498 [FrameworkBundle] Use SymfonyStyle in AbstractConfigCommand (JhonnyL)
This PR was merged into the 3.1-dev branch. Discussion ---------- [FrameworkBundle] Use SymfonyStyle in AbstractConfigCommand | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | | License | MIT | Doc PR | Before: ![screen shot 2016-04-10 at 18 12 56](https://cloud.githubusercontent.com/assets/1104667/14411548/ab040a32-ff4b-11e5-878d-7e6acb257750.png) After: ![screen shot 2016-04-10 at 18 11 57](https://cloud.githubusercontent.com/assets/1104667/14411553/be16e022-ff4b-11e5-838e-5fa2ad46133b.png) Commits ------- 30b44a8 [FrameworkBundle] Use SymfonyStyle in AbstractConfigCommand
2 parents ae922b0 + b152151 commit 5c51476

File tree

3 files changed

+9
-11
lines changed

3 files changed

+9
-11
lines changed

Command/AbstractConfigCommand.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ abstract class AbstractConfigCommand extends ContainerDebugCommand
2727
{
2828
protected function listBundles($output)
2929
{
30+
$title = 'Available registered bundles with their extension alias if available';
3031
$headers = array('Bundle name', 'Extension alias');
3132
$rows = array();
3233

@@ -41,9 +42,10 @@ protected function listBundles($output)
4142
}
4243

4344
if ($output instanceof StyleInterface) {
45+
$output->title($title);
4446
$output->table($headers, $rows);
4547
} else {
46-
$output->writeln('Available registered bundles with their extension alias if available:');
48+
$output->writeln($title);
4749
$table = new Table($output);
4850
$table->setHeaders($headers)->setRows($rows)->render($output);
4951
}

Command/ConfigDebugCommand.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,10 @@ protected function configure()
5656
protected function execute(InputInterface $input, OutputInterface $output)
5757
{
5858
$io = new SymfonyStyle($input, $output);
59-
$name = $input->getArgument('name');
6059

61-
if (empty($name)) {
62-
$io->comment('Provide the name of a bundle as the first argument of this command to dump its configuration.');
63-
$io->newLine();
64-
$this->listBundles($output);
60+
if (null === $name = $input->getArgument('name')) {
61+
$this->listBundles($io);
62+
$io->comment('Provide the name of a bundle as the first argument of this command to dump its configuration. (e.g. <comment>debug:config FrameworkBundle</comment>)');
6563

6664
return;
6765
}

Command/ConfigDumpReferenceCommand.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,10 @@ protected function configure()
6868
protected function execute(InputInterface $input, OutputInterface $output)
6969
{
7070
$io = new SymfonyStyle($input, $output);
71-
$name = $input->getArgument('name');
7271

73-
if (empty($name)) {
74-
$io->comment('Provide the name of a bundle as the first argument of this command to dump its default configuration.');
75-
$io->newLine();
76-
$this->listBundles($output);
72+
if (null === $name = $input->getArgument('name')) {
73+
$this->listBundles($io);
74+
$io->comment('Provide the name of a bundle as the first argument of this command to dump its default configuration. (e.g. <comment>config:dump-reference FrameworkBundle</comment>)');
7775

7876
return;
7977
}

0 commit comments

Comments
 (0)