Class Symfony\Component\Console\Helper\ProgressBar

InheritanceSymfony\Component\Console\Helper\ProgressBar

The ProgressBar provides helpers to display progress output.

Public Methods

Hide inherited methods

MethodDescriptionDefined By
__construct() Constructor. Symfony\Component\Console\Helper\ProgressBar
advance() Advances the progress output X steps. Symfony\Component\Console\Helper\ProgressBar
clear() Removes the progress bar from the current line. Symfony\Component\Console\Helper\ProgressBar
display() Outputs the current progress string. Symfony\Component\Console\Helper\ProgressBar
finish() Finishes the progress output. Symfony\Component\Console\Helper\ProgressBar
getBarCharacter() Gets the bar character. Symfony\Component\Console\Helper\ProgressBar
getBarWidth() Gets the progress bar width. Symfony\Component\Console\Helper\ProgressBar
getEmptyBarCharacter() Gets the empty bar character. Symfony\Component\Console\Helper\ProgressBar
getFormatDefinition() Gets the format for a given name. Symfony\Component\Console\Helper\ProgressBar
getMaxSteps() Gets the progress bar maximal steps. Symfony\Component\Console\Helper\ProgressBar
getMessage() Symfony\Component\Console\Helper\ProgressBar
getPlaceholderFormatterDefinition() Gets the placeholder formatter for a given name. Symfony\Component\Console\Helper\ProgressBar
getProgress() Gets the current step position. Symfony\Component\Console\Helper\ProgressBar
getProgressCharacter() Gets the progress bar character. Symfony\Component\Console\Helper\ProgressBar
getProgressPercent() Gets the current progress bar percent. Symfony\Component\Console\Helper\ProgressBar
getStartTime() Gets the progress bar start time. Symfony\Component\Console\Helper\ProgressBar
setBarCharacter() Sets the bar character. Symfony\Component\Console\Helper\ProgressBar
setBarWidth() Sets the progress bar width. Symfony\Component\Console\Helper\ProgressBar
setEmptyBarCharacter() Sets the empty bar character. Symfony\Component\Console\Helper\ProgressBar
setFormat() Sets the progress bar format. Symfony\Component\Console\Helper\ProgressBar
setFormatDefinition() Sets a format for a given name. Symfony\Component\Console\Helper\ProgressBar
setMessage() Associates a text with a named placeholder. Symfony\Component\Console\Helper\ProgressBar
setOverwrite() Sets whether to overwrite the progressbar, false for new line. Symfony\Component\Console\Helper\ProgressBar
setPlaceholderFormatterDefinition() Sets a placeholder formatter for a given name. Symfony\Component\Console\Helper\ProgressBar
setProgress() Sets the current progress. Symfony\Component\Console\Helper\ProgressBar
setProgressCharacter() Sets the progress bar character. Symfony\Component\Console\Helper\ProgressBar
setRedrawFrequency() Sets the redraw frequency. Symfony\Component\Console\Helper\ProgressBar
start() Starts the progress output. Symfony\Component\Console\Helper\ProgressBar

Method Details

__construct() public method

Constructor.

public void __construct ( Symfony\Component\Console\Output\OutputInterface $output, $max 0 )
$output Symfony\Component\Console\Output\OutputInterface

An OutputInterface instance

$max int

Maximum steps (0 if unknown)

advance() public method

Advances the progress output X steps.

public void advance ( $step 1 )
$step int

Number of steps to advance

throws Symfony\Component\Console\Exception\LogicException
clear() public method

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.

public void clear ( )
display() public method

Outputs the current progress string.

public void display ( )
finish() public method

Finishes the progress output.

public void finish ( )
getBarCharacter() public method

Gets the bar character.

public string getBarCharacter ( )
return string

A character

getBarWidth() public method

Gets the progress bar width.

public int getBarWidth ( )
return int

The progress bar size

getEmptyBarCharacter() public method

Gets the empty bar character.

public string getEmptyBarCharacter ( )
return string

A character

getFormatDefinition() public static method

Gets the format for a given name.

public static string|null getFormatDefinition ( $name )
$name string

The format name

return string|null

A format string

getMaxSteps() public method

Gets the progress bar maximal steps.

public int getMaxSteps ( )
return int

The progress bar max steps

getMessage() public method

public void getMessage ( $name 'message' )
$name
getPlaceholderFormatterDefinition() public static method

Gets the placeholder formatter for a given name.

public static callable|null getPlaceholderFormatterDefinition ( $name )
$name string

The placeholder name (including the delimiter char like %)

return callable|null

A PHP callable

getProgress() public method

Gets the current step position.

public int getProgress ( )
return int

The progress bar step

getProgressCharacter() public method

Gets the progress bar character.

public string getProgressCharacter ( )
return string

A character

getProgressPercent() public method

Gets the current progress bar percent.

public float getProgressPercent ( )
return float

The current progress bar percent

getStartTime() public method

Gets the progress bar start time.

public int getStartTime ( )
return int

The progress bar start time

setBarCharacter() public method

Sets the bar character.

public void setBarCharacter ( $char )
$char string

A character

setBarWidth() public method

Sets the progress bar width.

public void setBarWidth ( $size )
$size int

The progress bar size

setEmptyBarCharacter() public method

Sets the empty bar character.

public void setEmptyBarCharacter ( $char )
$char string

A character

setFormat() public method

Sets the progress bar format.

public void setFormat ( $format )
$format string

The format

setFormatDefinition() public static method

Sets a format for a given name.

This method also allow you to override an existing format.

public static void setFormatDefinition ( $name, $format )
$name string

The format name

$format string

A format string

setMessage() public method

Associates a text with a named placeholder.

The text is displayed when the progress bar is rendered but only when the corresponding placeholder is part of the custom format line (by wrapping the name with %).

public void setMessage ( $message, $name 'message' )
$message string

The text to associate with the placeholder

$name string

The name of the placeholder

setOverwrite() public method

Sets whether to overwrite the progressbar, false for new line.

public void setOverwrite ( $overwrite )
$overwrite bool
setPlaceholderFormatterDefinition() public static method

Sets a placeholder formatter for a given name.

This method also allow you to override an existing placeholder.

public static void setPlaceholderFormatterDefinition ( $name, callable $callable )
$name string

The placeholder name (including the delimiter char like %)

$callable callable

A PHP callable

setProgress() public method

Sets the current progress.

public void setProgress ( $step )
$step int

The current progress

throws Symfony\Component\Console\Exception\LogicException
setProgressCharacter() public method

Sets the progress bar character.

public void setProgressCharacter ( $char )
$char string

A character

setRedrawFrequency() public method

Sets the redraw frequency.

public void setRedrawFrequency ( $freq )
$freq int|float

The frequency in steps

start() public method

Starts the progress output.

public void start ( $max null )
$max int|null

Number of steps to complete the bar (0 if indeterminate), null to leave unchanged