Helper\ProgressBar (Component\Console)
Symfony\Component\Console\Helper\ProgressBar
class ProgressBar
The ProgressBar provides helpers to display progress output.
Methods
__construct(OutputInterface $output, int $max) Constructor. | ||
static | setPlaceholderFormatterDefinition(string $name, callable $callable) Sets a placeholder formatter for a given name. | |
static callable|null | getPlaceholderFormatterDefinition(string $name) Gets the placeholder formatter for a given name. | |
static | setFormatDefinition(string $name, string $format) Sets a format for a given name. | |
static string|null | getFormatDefinition(string $name) Gets the format for a given name. | |
setMessage($message, $name = 'message') | ||
getMessage($name = 'message') | ||
int | getStartTime() Gets the progress bar start time. | |
int | getMaxSteps() Gets the progress bar maximal steps. | |
int | getProgress() Gets the current step position. | |
float | getProgressPercent() Gets the current progress bar percent. | |
setBarWidth(int $size) Sets the progress bar width. | ||
int | getBarWidth() Gets the progress bar width. | |
setBarCharacter(string $char) Sets the bar character. | ||
string | getBarCharacter() Gets the bar character. | |
setEmptyBarCharacter(string $char) Sets the empty bar character. | ||
string | getEmptyBarCharacter() Gets the empty bar character. | |
setProgressCharacter(string $char) Sets the progress bar character. | ||
string | getProgressCharacter() Gets the progress bar character. | |
setFormat(string $format) Sets the progress bar format. | ||
setRedrawFrequency(int|float $freq) Sets the redraw frequency. | ||
start(int|null $max = null) Starts the progress output. | ||
advance(int $step = 1) Advances the progress output X steps. | ||
setOverwrite(bool $overwrite) Sets whether to overwrite the progressbar, false for new line. | ||
setProgress(int $step) Sets the current progress. | ||
finish() Finishes the progress output. | ||
display() Outputs the current progress string. | ||
clear() Removes the progress bar from the current line. |
Details
public __construct(OutputInterface $output, int $max)
Constructor.
static public setPlaceholderFormatterDefinition(string $name, callable $callable)
Sets a placeholder formatter for a given name.
This method also allow you to override an existing placeholder.
static public callable|null getPlaceholderFormatterDefinition(string $name)
Gets the placeholder formatter for a given name.
static public setFormatDefinition(string $name, string $format)
Sets a format for a given name.
This method also allow you to override an existing format.
static public string|null getFormatDefinition(string $name)
Gets the format for a given name.
public setMessage($message, $name = 'message')
public getMessage($name = 'message')
public int getStartTime()
Gets the progress bar start time.
public int getMaxSteps()
Gets the progress bar maximal steps.
public int getProgress()
Gets the current step position.
public float getProgressPercent()
Gets the current progress bar percent.
public setBarWidth(int $size)
Sets the progress bar width.
public int getBarWidth()
Gets the progress bar width.
public setBarCharacter(string $char)
Sets the bar character.
public string getBarCharacter()
Gets the bar character.
public setEmptyBarCharacter(string $char)
Sets the empty bar character.
public string getEmptyBarCharacter()
Gets the empty bar character.
public setProgressCharacter(string $char)
Sets the progress bar character.
public string getProgressCharacter()
Gets the progress bar character.
public setFormat(string $format)
Sets the progress bar format.
public setRedrawFrequency(int|float $freq)
Sets the redraw frequency.
public start(int|null $max = null)
Starts the progress output.
public advance(int $step = 1)
Advances the progress output X steps.
public setOverwrite(bool $overwrite)
Sets whether to overwrite the progressbar, false for new line.
public setProgress(int $step)
Sets the current progress.
public finish()
Finishes the progress output.
public display()
Outputs the current progress string.
public clear()
Removes the progress bar from the current line.
This is useful if you wish to write some output while a progress bar is running. Call display() to show the progress bar again.
© 2004–2016 Fabien Potencier
Licensed under the MIT License.
http://api.symfony.com/3.0/Symfony/Component/Console/Helper/ProgressBar.html