@@ -16,24 +16,24 @@ number of units, and advance the progress as the command executes::
1616 use Symfony\Component\Console\Helper\ProgressBar;
1717
1818 // creates a new progress bar (50 units)
19- $progress = new ProgressBar($output, 50);
19+ $progressBar = new ProgressBar($output, 50);
2020
2121 // starts and displays the progress bar
22- $progress ->start();
22+ $progressBar ->start();
2323
2424 $i = 0;
2525 while ($i++ < 50) {
2626 // ... do some work
2727
2828 // advances the progress bar 1 unit
29- $progress ->advance();
29+ $progressBar ->advance();
3030
3131 // you can also advance the progress bar by more than 1 unit
32- // $progress ->advance(3);
32+ // $progressBar ->advance(3);
3333 }
3434
3535 // ensures that the progress bar is at 100%
36- $progress ->finish();
36+ $progressBar ->finish();
3737
3838Instead of advancing the bar by a number of steps (with the
3939:method: `Symfony\\ Component\\ Console\\ Helper\\ ProgressBar::advance ` method),
@@ -53,7 +53,7 @@ If you don't know the number of steps in advance, just omit the steps argument
5353when creating the :class: `Symfony\\ Component\\ Console\\ Helper\\ ProgressBar `
5454instance::
5555
56- $progress = new ProgressBar($output);
56+ $progressBar = new ProgressBar($output);
5757
5858The progress will then be displayed as a throbber:
5959
@@ -120,7 +120,7 @@ level of verbosity of the ``OutputInterface`` instance:
120120Instead of relying on the verbosity mode of the current command, you can also
121121force a format via ``setFormat() ``::
122122
123- $bar ->setFormat('verbose');
123+ $progressBar ->setFormat('verbose');
124124
125125The built-in formats are the following:
126126
@@ -142,7 +142,7 @@ Custom Formats
142142
143143Instead of using the built-in formats, you can also set your own::
144144
145- $bar ->setFormat('%bar%');
145+ $progressBar ->setFormat('%bar%');
146146
147147This sets the format to only display the progress bar itself:
148148
@@ -169,7 +169,7 @@ current progress of the bar. Here is a list of the built-in placeholders:
169169For instance, here is how you could set the format to be the same as the
170170``debug `` one::
171171
172- $bar ->setFormat(' %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%/%estimated:-6s% %memory:6s%');
172+ $progressBar ->setFormat(' %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%/%estimated:-6s% %memory:6s%');
173173
174174Notice the ``:6s `` part added to some placeholders? That's how you can tweak
175175the appearance of the bar (formatting and alignment). The part after the colon
@@ -180,8 +180,8 @@ also define global formats::
180180
181181 ProgressBar::setFormatDefinition('minimal', 'Progress: %percent%%');
182182
183- $bar = new ProgressBar($output, 3);
184- $bar ->setFormat('minimal');
183+ $progressBar = new ProgressBar($output, 3);
184+ $progressBar ->setFormat('minimal');
185185
186186This code defines a new ``minimal `` format that you can then use for your
187187progress bars:
@@ -205,8 +205,8 @@ variant::
205205 ProgressBar::setFormatDefinition('minimal', '%percent%% %remaining%');
206206 ProgressBar::setFormatDefinition('minimal_nomax', '%percent%%');
207207
208- $bar = new ProgressBar($output);
209- $bar ->setFormat('minimal');
208+ $progressBar = new ProgressBar($output);
209+ $progressBar ->setFormat('minimal');
210210
211211When displaying the progress bar, the format will automatically be set to
212212``minimal_nomax `` if the bar does not have a maximum number of steps like in
@@ -235,16 +235,16 @@ Amongst the placeholders, ``bar`` is a bit special as all the characters used
235235to display it can be customized::
236236
237237 // the finished part of the bar
238- $progress ->setBarCharacter('<comment>=</comment>');
238+ $progressBar ->setBarCharacter('<comment>=</comment>');
239239
240240 // the unfinished part of the bar
241- $progress ->setEmptyBarCharacter(' ');
241+ $progressBar ->setEmptyBarCharacter(' ');
242242
243243 // the progress character
244- $progress ->setProgressCharacter('|');
244+ $progressBar ->setProgressCharacter('|');
245245
246246 // the bar width
247- $progress ->setBarWidth(50);
247+ $progressBar ->setBarWidth(50);
248248
249249.. caution ::
250250
@@ -254,17 +254,17 @@ to display it can be customized::
254254 :method: `Symfony\\ Component\\ Console\\ Helper\\ ProgressBar::setRedrawFrequency `,
255255 so it updates on only some iterations::
256256
257- $progress = new ProgressBar($output, 50000);
258- $progress ->start();
257+ $progressBar = new ProgressBar($output, 50000);
258+ $progressBar ->start();
259259
260260 // update every 100 iterations
261- $progress ->setRedrawFrequency(100);
261+ $progressBar ->setRedrawFrequency(100);
262262
263263 $i = 0;
264264 while ($i++ < 50000) {
265265 // ... do some work
266266
267- $progress ->advance();
267+ $progressBar ->advance();
268268 }
269269
270270Custom Placeholders
@@ -277,8 +277,8 @@ that displays the number of remaining steps::
277277
278278 ProgressBar::setPlaceholderFormatterDefinition(
279279 'remaining_steps',
280- function (ProgressBar $bar , OutputInterface $output) {
281- return $bar ->getMaxSteps() - $bar ->getProgress();
280+ function (ProgressBar $progressBar , OutputInterface $output) {
281+ return $progressBar ->getMaxSteps() - $progressBar ->getProgress();
282282 }
283283 );
284284
0 commit comments