Skip to content

Commit 57769e1

Browse files
committed
formatting update
1 parent 3a807f3 commit 57769e1

15 files changed

Lines changed: 1262 additions & 1269 deletions

src/Command/Command.php

Lines changed: 91 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -20,103 +20,103 @@
2020
*/
2121
class Command extends BaseCommand
2222
{
23-
protected function configure()
24-
{
25-
$this
26-
// the name of the command (the part after "bin/console")
27-
->setName('myadmin')
28-
// the short description shown while running "php bin/console list"
29-
->setDescription('Creates a new user.')
30-
// the full command description shown when running the command with the "--help" option
31-
->setHelp('This command allows you to create a user...');
32-
//->addArgument('username', InputArgument::REQUIRED, 'The username of the user.');
33-
}
23+
protected function configure()
24+
{
25+
$this
26+
// the name of the command (the part after "bin/console")
27+
->setName('myadmin')
28+
// the short description shown while running "php bin/console list"
29+
->setDescription('Creates a new user.')
30+
// the full command description shown when running the command with the "--help" option
31+
->setHelp('This command allows you to create a user...');
32+
//->addArgument('username', InputArgument::REQUIRED, 'The username of the user.');
33+
}
3434

35-
/** (optional)
36-
* This method is executed before the interact() and the execute() methods.
37-
* Its main purpose is to initialize variables used in the rest of the command methods.
38-
*
39-
* @param \Symfony\Component\Console\Input\InputInterface $input
40-
* @param \Symfony\Component\Console\Output\OutputInterface $output
41-
*/
42-
protected function initialize(InputInterface $input, OutputInterface $output)
43-
{
44-
}
35+
/** (optional)
36+
* This method is executed before the interact() and the execute() methods.
37+
* Its main purpose is to initialize variables used in the rest of the command methods.
38+
*
39+
* @param \Symfony\Component\Console\Input\InputInterface $input
40+
* @param \Symfony\Component\Console\Output\OutputInterface $output
41+
*/
42+
protected function initialize(InputInterface $input, OutputInterface $output)
43+
{
44+
}
4545

46-
/** (optional)
47-
* This method is executed after initialize() and before execute().
48-
* Its purpose is to check if some of the options/arguments are missing and interactively
49-
* ask the user for those values. This is the last place where you can ask for missing
50-
* options/arguments. After this command, missing options/arguments will result in an error.
51-
*
52-
* @param \Symfony\Component\Console\Input\InputInterface $input
53-
* @param \Symfony\Component\Console\Output\OutputInterface $output
54-
*/
55-
protected function interact(InputInterface $input, OutputInterface $output)
56-
{
57-
}
46+
/** (optional)
47+
* This method is executed after initialize() and before execute().
48+
* Its purpose is to check if some of the options/arguments are missing and interactively
49+
* ask the user for those values. This is the last place where you can ask for missing
50+
* options/arguments. After this command, missing options/arguments will result in an error.
51+
*
52+
* @param \Symfony\Component\Console\Input\InputInterface $input
53+
* @param \Symfony\Component\Console\Output\OutputInterface $output
54+
*/
55+
protected function interact(InputInterface $input, OutputInterface $output)
56+
{
57+
}
5858

59-
/** (required)
60-
* This method is executed after interact() and initialize().
61-
* It contains the logic you want the command to execute.
62-
*
63-
* @param InputInterface $input
64-
* @param OutputInterface $output
65-
*/
66-
protected function execute(InputInterface $input, OutputInterface $output)
67-
{
68-
$output->writeln([ // outputs multiple lines to the console (adding "\n" at the end of each line)
69-
'User Creator',
70-
'============',
71-
''
72-
]);
73-
/*
74-
$output->writeln('Username: '.$input->getArgument('username')); // retrieve the argument value using getArgument()
75-
*/
76-
$output->write('You are about to '); // outputs a message without adding a "\n" at the end of the line
77-
$output->write('create a user.');
59+
/** (required)
60+
* This method is executed after interact() and initialize().
61+
* It contains the logic you want the command to execute.
62+
*
63+
* @param InputInterface $input
64+
* @param OutputInterface $output
65+
*/
66+
protected function execute(InputInterface $input, OutputInterface $output)
67+
{
68+
$output->writeln([ // outputs multiple lines to the console (adding "\n" at the end of each line)
69+
'User Creator',
70+
'============',
71+
''
72+
]);
73+
/*
74+
$output->writeln('Username: '.$input->getArgument('username')); // retrieve the argument value using getArgument()
75+
*/
76+
$output->write('You are about to '); // outputs a message without adding a "\n" at the end of the line
77+
$output->write('create a user.');
7878

79-
/** Coloring
80-
* @link http://symfony.com/doc/current/console/coloring.html
81-
*/
82-
$output->writeln('<info>foo</info>'); // green text
83-
$output->writeln('<comment>foo</comment>'); // yellow text
84-
$output->writeln('<question>foo</question>'); // black text on a cyan background
85-
$output->writeln('<error>foo</error>'); // white text on a red background
79+
/** Coloring
80+
* @link http://symfony.com/doc/current/console/coloring.html
81+
*/
82+
$output->writeln('<info>foo</info>'); // green text
83+
$output->writeln('<comment>foo</comment>'); // yellow text
84+
$output->writeln('<question>foo</question>'); // black text on a cyan background
85+
$output->writeln('<error>foo</error>'); // white text on a red background
8686

87-
/** Formatting
88-
* @link http://symfony.com/doc/current/components/console/helpers/formatterhelper.html
89-
*/
90-
$formatter = $this->getHelper('formatter');
91-
// Section - [SomeSection] Here is some message related to that section
92-
$formattedLine = $formatter->formatSection('SomeSection', 'Here is some message related to that section');
93-
$output->writeln($formattedLine);
94-
// Error Block
95-
$errorMessages = ['Error!', 'Something went wrong'];
96-
$formattedBlock = $formatter->formatBlock($errorMessages, 'error');
97-
$output->writeln($formattedBlock);
98-
// Truncated Messages
99-
$message = 'This is a very long message, which should be truncated';
100-
$truncatedMessage = $formatter->truncate($message, 7); // This is...
101-
$truncatedMessage = $formatter->truncate($message, 7, '!!'); // result: This is!!
102-
$output->writeln($truncatedMessage);
87+
/** Formatting
88+
* @link http://symfony.com/doc/current/components/console/helpers/formatterhelper.html
89+
*/
90+
$formatter = $this->getHelper('formatter');
91+
// Section - [SomeSection] Here is some message related to that section
92+
$formattedLine = $formatter->formatSection('SomeSection', 'Here is some message related to that section');
93+
$output->writeln($formattedLine);
94+
// Error Block
95+
$errorMessages = ['Error!', 'Something went wrong'];
96+
$formattedBlock = $formatter->formatBlock($errorMessages, 'error');
97+
$output->writeln($formattedBlock);
98+
// Truncated Messages
99+
$message = 'This is a very long message, which should be truncated';
100+
$truncatedMessage = $formatter->truncate($message, 7); // This is...
101+
$truncatedMessage = $formatter->truncate($message, 7, '!!'); // result: This is!!
102+
$output->writeln($truncatedMessage);
103103

104-
/** Table
105-
* @link http://symfony.com/doc/current/components/console/helpers/table.html
106-
*/
104+
/** Table
105+
* @link http://symfony.com/doc/current/components/console/helpers/table.html
106+
*/
107107

108-
/** Style
109-
* @link http://symfony.com/doc/current/console/style.html
110-
*/
108+
/** Style
109+
* @link http://symfony.com/doc/current/console/style.html
110+
*/
111111

112-
/** Process Helper
113-
* @link http://symfony.com/doc/current/components/console/helpers/processhelper.html
114-
*/
115-
/** Progress Bar
116-
* @link http://symfony.com/doc/current/components/console/helpers/progressbar.html
117-
*/
118-
/** Question Helper
119-
* @link http://symfony.com/doc/current/components/console/helpers/questionhelper.html
120-
*/
121-
}
112+
/** Process Helper
113+
* @link http://symfony.com/doc/current/components/console/helpers/processhelper.html
114+
*/
115+
/** Progress Bar
116+
* @link http://symfony.com/doc/current/components/console/helpers/progressbar.html
117+
*/
118+
/** Question Helper
119+
* @link http://symfony.com/doc/current/components/console/helpers/questionhelper.html
120+
*/
121+
}
122122
}

src/Command/CreateUser.php

Lines changed: 95 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -23,107 +23,107 @@
2323
*/
2424
class CreateUser extends BaseCommand
2525
{
26-
protected function configure()
27-
{
28-
$this
29-
->setName('myadmin:create-user') // the name of the command (the part after "bin/console")
30-
->setDescription('Creates a new user.') // the short description shown while running "php bin/console list"
31-
->setHelp('This command allows you to create a user...') // the full command description shown when running the command with the "--help" option
32-
/* http://symfony.com/doc/current/components/console/console_arguments.html
33-
->setDefinition(
34-
new InputDefinition(array(
35-
new InputOption('foo', 'f'),
36-
new InputOption('bar', 'b', InputOption::VALUE_REQUIRED),
37-
new InputOption('cat', 'c', InputOption::VALUE_OPTIONAL),
38-
))
39-
)
40-
*/
41-
->addArgument('username', InputArgument::REQUIRED, 'The username of the user.'); // configure an argument
42-
}
26+
protected function configure()
27+
{
28+
$this
29+
->setName('myadmin:create-user') // the name of the command (the part after "bin/console")
30+
->setDescription('Creates a new user.') // the short description shown while running "php bin/console list"
31+
->setHelp('This command allows you to create a user...') // the full command description shown when running the command with the "--help" option
32+
/* http://symfony.com/doc/current/components/console/console_arguments.html
33+
->setDefinition(
34+
new InputDefinition(array(
35+
new InputOption('foo', 'f'),
36+
new InputOption('bar', 'b', InputOption::VALUE_REQUIRED),
37+
new InputOption('cat', 'c', InputOption::VALUE_OPTIONAL),
38+
))
39+
)
40+
*/
41+
->addArgument('username', InputArgument::REQUIRED, 'The username of the user.'); // configure an argument
42+
}
4343

44-
/** (optional)
45-
* This method is executed before the interact() and the execute() methods.
46-
* Its main purpose is to initialize variables used in the rest of the command methods.
47-
*
48-
* @param \Symfony\Component\Console\Input\InputInterface $input
49-
* @param \Symfony\Component\Console\Output\OutputInterface $output
50-
*/
51-
protected function initialize(InputInterface $input, OutputInterface $output)
52-
{
53-
}
44+
/** (optional)
45+
* This method is executed before the interact() and the execute() methods.
46+
* Its main purpose is to initialize variables used in the rest of the command methods.
47+
*
48+
* @param \Symfony\Component\Console\Input\InputInterface $input
49+
* @param \Symfony\Component\Console\Output\OutputInterface $output
50+
*/
51+
protected function initialize(InputInterface $input, OutputInterface $output)
52+
{
53+
}
5454

55-
/** (optional)
56-
* This method is executed after initialize() and before execute().
57-
* Its purpose is to check if some of the options/arguments are missing and interactively
58-
* ask the user for those values. This is the last place where you can ask for missing
59-
* options/arguments. After this command, missing options/arguments will result in an error.
60-
*
61-
* @param \Symfony\Component\Console\Input\InputInterface $input
62-
* @param \Symfony\Component\Console\Output\OutputInterface $output
63-
*/
64-
protected function interact(InputInterface $input, OutputInterface $output)
65-
{
66-
}
55+
/** (optional)
56+
* This method is executed after initialize() and before execute().
57+
* Its purpose is to check if some of the options/arguments are missing and interactively
58+
* ask the user for those values. This is the last place where you can ask for missing
59+
* options/arguments. After this command, missing options/arguments will result in an error.
60+
*
61+
* @param \Symfony\Component\Console\Input\InputInterface $input
62+
* @param \Symfony\Component\Console\Output\OutputInterface $output
63+
*/
64+
protected function interact(InputInterface $input, OutputInterface $output)
65+
{
66+
}
6767

68-
/** (required)
69-
* This method is executed after interact() and initialize().
70-
* It contains the logic you want the command to execute.
71-
*
72-
* @param InputInterface $input
73-
* @param OutputInterface $output
74-
*/
75-
protected function execute(InputInterface $input, OutputInterface $output)
76-
{
77-
$output->writeln([ // outputs multiple lines to the console (adding "\n" at the end of each line)
78-
'User Creator',
79-
'============',
80-
''
81-
]);
82-
$output->writeln('Username: '.$input->getArgument('username')); // retrieve the argument value using getArgument()
83-
$output->write('You are about to '); // outputs a message without adding a "\n" at the end of the line
84-
$output->write('create a user.');
68+
/** (required)
69+
* This method is executed after interact() and initialize().
70+
* It contains the logic you want the command to execute.
71+
*
72+
* @param InputInterface $input
73+
* @param OutputInterface $output
74+
*/
75+
protected function execute(InputInterface $input, OutputInterface $output)
76+
{
77+
$output->writeln([ // outputs multiple lines to the console (adding "\n" at the end of each line)
78+
'User Creator',
79+
'============',
80+
''
81+
]);
82+
$output->writeln('Username: '.$input->getArgument('username')); // retrieve the argument value using getArgument()
83+
$output->write('You are about to '); // outputs a message without adding a "\n" at the end of the line
84+
$output->write('create a user.');
8585

86-
/** Coloring
87-
* @link http://symfony.com/doc/current/console/coloring.html
88-
*/
89-
$output->writeln('<info>foo</info>'); // green text
90-
$output->writeln('<comment>foo</comment>'); // yellow text
91-
$output->writeln('<question>foo</question>'); // black text on a cyan background
92-
$output->writeln('<error>foo</error>'); // white text on a red background
86+
/** Coloring
87+
* @link http://symfony.com/doc/current/console/coloring.html
88+
*/
89+
$output->writeln('<info>foo</info>'); // green text
90+
$output->writeln('<comment>foo</comment>'); // yellow text
91+
$output->writeln('<question>foo</question>'); // black text on a cyan background
92+
$output->writeln('<error>foo</error>'); // white text on a red background
9393

94-
/** Formatting
95-
* @link http://symfony.com/doc/current/components/console/helpers/formatterhelper.html
96-
*/
97-
$formatter = $this->getHelper('formatter');
98-
// Section - [SomeSection] Here is some message related to that section
99-
$formattedLine = $formatter->formatSection('SomeSection', 'Here is some message related to that section');
100-
$output->writeln($formattedLine);
101-
// Error Block
102-
$errorMessages = ['Error!', 'Something went wrong'];
103-
$formattedBlock = $formatter->formatBlock($errorMessages, 'error');
104-
$output->writeln($formattedBlock);
105-
// Truncated Messages
106-
$message = 'This is a very long message, which should be truncated';
107-
$truncatedMessage = $formatter->truncate($message, 7); // This is...
108-
$truncatedMessage = $formatter->truncate($message, 7, '!!'); // result: This is!!
109-
$output->writeln($truncatedMessage);
94+
/** Formatting
95+
* @link http://symfony.com/doc/current/components/console/helpers/formatterhelper.html
96+
*/
97+
$formatter = $this->getHelper('formatter');
98+
// Section - [SomeSection] Here is some message related to that section
99+
$formattedLine = $formatter->formatSection('SomeSection', 'Here is some message related to that section');
100+
$output->writeln($formattedLine);
101+
// Error Block
102+
$errorMessages = ['Error!', 'Something went wrong'];
103+
$formattedBlock = $formatter->formatBlock($errorMessages, 'error');
104+
$output->writeln($formattedBlock);
105+
// Truncated Messages
106+
$message = 'This is a very long message, which should be truncated';
107+
$truncatedMessage = $formatter->truncate($message, 7); // This is...
108+
$truncatedMessage = $formatter->truncate($message, 7, '!!'); // result: This is!!
109+
$output->writeln($truncatedMessage);
110110

111-
/** Table
112-
* @link http://symfony.com/doc/current/components/console/helpers/table.html
113-
*/
111+
/** Table
112+
* @link http://symfony.com/doc/current/components/console/helpers/table.html
113+
*/
114114

115-
/** Style
116-
* @link http://symfony.com/doc/current/console/style.html
117-
*/
115+
/** Style
116+
* @link http://symfony.com/doc/current/console/style.html
117+
*/
118118

119-
/** Process Helper
120-
* @link http://symfony.com/doc/current/components/console/helpers/processhelper.html
121-
*/
122-
/** Progress Bar
123-
* @link http://symfony.com/doc/current/components/console/helpers/progressbar.html
124-
*/
125-
/** Question Helper
126-
* @link http://symfony.com/doc/current/components/console/helpers/questionhelper.html
127-
*/
128-
}
119+
/** Process Helper
120+
* @link http://symfony.com/doc/current/components/console/helpers/processhelper.html
121+
*/
122+
/** Progress Bar
123+
* @link http://symfony.com/doc/current/components/console/helpers/progressbar.html
124+
*/
125+
/** Question Helper
126+
* @link http://symfony.com/doc/current/components/console/helpers/questionhelper.html
127+
*/
128+
}
129129
}

0 commit comments

Comments
 (0)