PHP Класс Symfony\Component\Console\Helper\ProgressBar

Автор: Fabien Potencier ([email protected])
Автор: Chris Jones ([email protected])
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
__construct ( Symfony\Component\Console\Output\OutputInterface $output, integer $max )
advance ( integer $step = 1 ) Advances the progress output X steps.
clear ( ) Removes the progress bar from the current line.
display ( ) Outputs the current progress string.
finish ( ) Finishes the progress output.
getBarCharacter ( ) : string Gets the bar character.
getBarWidth ( ) : integer Gets the progress bar width.
getEmptyBarCharacter ( ) : string Gets the empty bar character.
getFormatDefinition ( string $name ) : string | null Gets the format for a given name.
getMaxSteps ( ) : integer Gets the progress bar maximal steps.
getMessage ( $name = 'message' )
getPlaceholderFormatterDefinition ( string $name ) : callable | null Gets the placeholder formatter for a given name.
getProgress ( ) : integer Gets the current step position.
getProgressCharacter ( ) : string Gets the progress bar character.
getProgressPercent ( ) : float Gets the current progress bar percent.
getStartTime ( ) : integer Gets the progress bar start time.
setBarCharacter ( string $char ) Sets the bar character.
setBarWidth ( integer $size ) Sets the progress bar width.
setEmptyBarCharacter ( string $char ) Sets the empty bar character.
setFormat ( string $format ) Sets the progress bar format.
setFormatDefinition ( string $name, string $format ) Sets a format for a given name.
setMessage ( string $message, string $name = 'message' ) Associates a text with a named placeholder.
setOverwrite ( boolean $overwrite ) Sets whether to overwrite the progressbar, false for new line.
setPlaceholderFormatterDefinition ( string $name, callable $callable ) Sets a placeholder formatter for a given name.
setProgress ( integer $step ) Sets the current progress.
setProgressCharacter ( string $char ) Sets the progress bar character.
setRedrawFrequency ( integer | float $freq ) Sets the redraw frequency.
start ( integer | null $max = null ) Starts the progress output.

Приватные методы

Метод Описание
buildLine ( ) : string
determineBestFormat ( )
getStepWidth ( ) : integer Gets the progress bar step width.
initFormats ( )
initPlaceholderFormatters ( )
overwrite ( string $message ) Overwrites a previous message to the output.
setMaxSteps ( integer $max ) Sets the progress bar maximal steps.
setRealFormat ( string $format ) Sets the progress bar format.

Описание методов

__construct() публичный Метод

public __construct ( Symfony\Component\Console\Output\OutputInterface $output, integer $max )
$output Symfony\Component\Console\Output\OutputInterface An OutputInterface instance
$max integer Maximum steps (0 if unknown)

advance() публичный Метод

Advances the progress output X steps.
public advance ( integer $step = 1 )
$step integer Number of steps to advance

clear() публичный Метод

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 clear ( )

display() публичный Метод

Outputs the current progress string.
public display ( )

finish() публичный Метод

Finishes the progress output.
public finish ( )

getBarCharacter() публичный Метод

Gets the bar character.
public getBarCharacter ( ) : string
Результат string A character

getBarWidth() публичный Метод

Gets the progress bar width.
public getBarWidth ( ) : integer
Результат integer The progress bar size

getEmptyBarCharacter() публичный Метод

Gets the empty bar character.
public getEmptyBarCharacter ( ) : string
Результат string A character

getFormatDefinition() публичный статический Метод

Gets the format for a given name.
public static getFormatDefinition ( string $name ) : string | null
$name string The format name
Результат string | null A format string

getMaxSteps() публичный Метод

Gets the progress bar maximal steps.
public getMaxSteps ( ) : integer
Результат integer The progress bar max steps

getMessage() публичный Метод

public getMessage ( $name = 'message' )

getPlaceholderFormatterDefinition() публичный статический Метод

Gets the placeholder formatter for a given name.
public static getPlaceholderFormatterDefinition ( string $name ) : callable | null
$name string The placeholder name (including the delimiter char like %)
Результат callable | null A PHP callable

getProgress() публичный Метод

Gets the current step position.
public getProgress ( ) : integer
Результат integer The progress bar step

getProgressCharacter() публичный Метод

Gets the progress bar character.
public getProgressCharacter ( ) : string
Результат string A character

getProgressPercent() публичный Метод

Gets the current progress bar percent.
public getProgressPercent ( ) : float
Результат float The current progress bar percent

getStartTime() публичный Метод

Gets the progress bar start time.
public getStartTime ( ) : integer
Результат integer The progress bar start time

setBarCharacter() публичный Метод

Sets the bar character.
public setBarCharacter ( string $char )
$char string A character

setBarWidth() публичный Метод

Sets the progress bar width.
public setBarWidth ( integer $size )
$size integer The progress bar size

setEmptyBarCharacter() публичный Метод

Sets the empty bar character.
public setEmptyBarCharacter ( string $char )
$char string A character

setFormat() публичный Метод

Sets the progress bar format.
public setFormat ( string $format )
$format string The format

setFormatDefinition() публичный статический Метод

This method also allow you to override an existing format.
public static setFormatDefinition ( string $name, string $format )
$name string The format name
$format string A format string

setMessage() публичный Метод

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 setMessage ( string $message, string $name = 'message' )
$message string The text to associate with the placeholder
$name string The name of the placeholder

setOverwrite() публичный Метод

Sets whether to overwrite the progressbar, false for new line.
public setOverwrite ( boolean $overwrite )
$overwrite boolean

setPlaceholderFormatterDefinition() публичный статический Метод

This method also allow you to override an existing placeholder.
public static setPlaceholderFormatterDefinition ( string $name, callable $callable )
$name string The placeholder name (including the delimiter char like %)
$callable callable A PHP callable

setProgress() публичный Метод

Sets the current progress.
public setProgress ( integer $step )
$step integer The current progress

setProgressCharacter() публичный Метод

Sets the progress bar character.
public setProgressCharacter ( string $char )
$char string A character

setRedrawFrequency() публичный Метод

Sets the redraw frequency.
public setRedrawFrequency ( integer | float $freq )
$freq integer | float The frequency in steps

start() публичный Метод

Starts the progress output.
public start ( integer | null $max = null )
$max integer | null Number of steps to complete the bar (0 if indeterminate), null to leave unchanged