Skip to content

Commit

Permalink
[Console] Update some method names
Browse files Browse the repository at this point in the history
  • Loading branch information
javiereguiluz committed Nov 8, 2019
1 parent dd656d9 commit 316a48b
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions components/console/helpers/progressbar.rst
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,16 @@ you can also set the current progress by calling the

If your platform doesn't support ANSI codes, updates to the progress
bar are added as new lines. To prevent the output from being flooded,
use the method :method:`Symfony\\Component\\Console\\Helper\\ProgressBar::preventRedrawFasterThan`
(it writes to the output after every N seconds) and the method
use the method :method:`Symfony\\Component\\Console\\Helper\\ProgressBar::minSecondsBetweenRedraws`
to limit the number of redraws and the method
:method:`Symfony\\Component\\Console\\Helper\\ProgressBar::setRedrawFrequency`
(it writes to the output every N iterations). By default, redraw frequency is
to redraw every N iterations. By default, redraw frequency is
**100ms** or **10%** of your ``max``.

.. versionadded:: 4.4

The ``preventRedrawFasterThan()`` method was introduced in Symfony 4.4.
The ``minSecondsBetweenRedraws()`` and ``maxSecondsBetweenRedraws()``
methods were introduced in Symfony 4.4.

If you don't know the exact number of steps in advance, set it to a reasonable
value and then call the ``setMaxSteps()`` method to update it as needed::
Expand Down Expand Up @@ -295,19 +296,18 @@ to display it can be customized::
.. caution::

For performance reasons, Symfony redraws screen every 100ms. If this is too
fast or to slow for your application, use these methods:
:method:`Symfony\\Component\\Console\\Helper\\ProgressBar::preventRedrawFasterThan`
:method:`Symfony\\Component\\Console\\Helper\\ProgressBar::setRedrawFrequency`
:method:`Symfony\\Component\\Console\\Helper\\ProgressBar::forceRedrawSlowerThan`::
fast or to slow for your application, use the methods
:method:`Symfony\\Component\\Console\\Helper\\ProgressBar::minSecondsBetweenRedraws` and
:method:`Symfony\\Component\\Console\\Helper\\ProgressBar::maxSecondsBetweenRedraws`::

$progressBar = new ProgressBar($output, 50000);
$progressBar->start();

// this redraws the screen every 100 iterations, but sets additional limits:
// don't redraw slower than 100ms (0.1) or faster than 200ms (0.2)
// don't redraw slower than 200ms (0.2) or faster than 100ms (0.1)
$progressBar->setRedrawFrequency(100);
$progressBar->forceRedrawSlowerThan(0.2);
$progressBar->preventRedrawFasterThan(0.1);
$progressBar->maxSecondsBetweenRedraws(0.2);
$progressBar->minSecondsBetweenRedraws(0.1);

$i = 0;
while ($i++ < 50000) {
Expand All @@ -318,7 +318,7 @@ to display it can be customized::

.. versionadded:: 4.4

The ``forceRedrawSlowerThan`` and ``preventRedrawFasterThan()`` methods
The ``minSecondsBetweenRedraws`` and ``maxSecondsBetweenRedraws()`` methods
were introduced in Symfony 4.4.

Custom Placeholders
Expand Down

0 comments on commit 316a48b

Please sign in to comment.