![]() |
TYPO3
7.6
|
Public Member Functions | |
__construct (OutputInterface $output, $max=0) | |
setMessage ($message, $name= 'message') | |
getMessage ($name= 'message') | |
getStartTime () | |
getMaxSteps () | |
getStep () | |
getProgress () | |
getStepWidth () | |
getProgressPercent () | |
setBarWidth ($size) | |
getBarWidth () | |
setBarCharacter ($char) | |
getBarCharacter () | |
setEmptyBarCharacter ($char) | |
getEmptyBarCharacter () | |
setProgressCharacter ($char) | |
getProgressCharacter () | |
setFormat ($format) | |
setRedrawFrequency ($freq) | |
start ($max=null) | |
advance ($step=1) | |
setCurrent ($step) | |
setOverwrite ($overwrite) | |
setProgress ($step) | |
finish () | |
display () | |
clear () | |
Static Public Member Functions | |
static | setPlaceholderFormatterDefinition ($name, $callable) |
static | getPlaceholderFormatterDefinition ($name) |
static | setFormatDefinition ($name, $format) |
static | getFormatDefinition ($name) |
Private Member Functions | |
setMaxSteps ($max) | |
overwrite ($message) | |
determineBestFormat () | |
Static Private Member Functions | |
static | initPlaceholderFormatters () |
static | initFormats () |
Private Attributes | |
$barWidth = 28 | |
$barChar | |
$emptyBarChar = '-' | |
$progressChar = '>' | |
$format = null | |
$redrawFreq = 1 | |
$output | |
$step = 0 | |
$max | |
$startTime | |
$stepWidth | |
$percent = 0.0 | |
$lastMessagesLength = 0 | |
$formatLineCount | |
$messages | |
$overwrite = true | |
Static Private Attributes | |
static | $formatters |
static | $formats |
The ProgressBar provides helpers to display progress output.
Definition at line 22 of file ProgressBar.php.
__construct | ( | OutputInterface | $output, |
$max = 0 |
|||
) |
Constructor.
OutputInterface | $output | An OutputInterface instance |
int | $max | Maximum steps (0 if unknown) |
Definition at line 55 of file ProgressBar.php.
References ProgressBar\$max, ProgressBar\$output, ProgressBar\determineBestFormat(), ProgressBar\overwrite(), ProgressBar\setFormat(), ProgressBar\setMaxSteps(), and ProgressBar\setRedrawFrequency().
advance | ( | $step = 1 | ) |
Advances the progress output X steps.
int | $step | Number of steps to advance |
\LogicException |
Definition at line 355 of file ProgressBar.php.
References ProgressBar\$step, and ProgressBar\setProgress().
Referenced by ProgressBarTest\testAnsiColorsAndEmojis().
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.
Definition at line 467 of file ProgressBar.php.
References ProgressBar\overwrite().
|
private |
Definition at line 527 of file ProgressBar.php.
References OutputInterface\VERBOSITY_DEBUG, OutputInterface\VERBOSITY_VERBOSE, and OutputInterface\VERBOSITY_VERY_VERBOSE.
Referenced by ProgressBar\__construct().
display | ( | ) |
Outputs the current progress string.
Definition at line 433 of file ProgressBar.php.
References ProgressBar\$format, ProgressBar\$messages, ProgressBar\$output, elseif, ProgressBar\overwrite(), and OutputInterface\VERBOSITY_QUIET.
Referenced by ProgressBar\setProgress(), and ProgressBar\start().
finish | ( | ) |
Finishes the progress output.
Definition at line 416 of file ProgressBar.php.
References ProgressBar\$step, ProgressBar\overwrite(), and ProgressBar\setProgress().
Referenced by ProgressBarTest\testAnsiColorsAndEmojis().
getBarCharacter | ( | ) |
Gets the bar character.
Definition at line 252 of file ProgressBar.php.
References ProgressBar\$barChar, and ProgressBar\$emptyBarChar.
Referenced by ProgressBar\initPlaceholderFormatters().
getBarWidth | ( | ) |
Gets the progress bar width.
Definition at line 232 of file ProgressBar.php.
References ProgressBar\$barWidth.
Referenced by ProgressBar\initPlaceholderFormatters().
getEmptyBarCharacter | ( | ) |
Gets the empty bar character.
Definition at line 276 of file ProgressBar.php.
References ProgressBar\$emptyBarChar.
Referenced by ProgressBar\initPlaceholderFormatters().
|
static |
Gets the format for a given name.
string | $name | The format name |
Definition at line 132 of file ProgressBar.php.
getMaxSteps | ( | ) |
Gets the progress bar maximal steps.
Definition at line 166 of file ProgressBar.php.
References ProgressBar\$max.
Referenced by ProgressBar\initPlaceholderFormatters(), and ProgressBarTest\testAddingPlaceholderFormatter().
getMessage | ( | $name = 'message' | ) |
Definition at line 146 of file ProgressBar.php.
|
static |
Gets the placeholder formatter for a given name.
string | $name | The placeholder name (including the delimiter char like %) |
Definition at line 99 of file ProgressBar.php.
getProgress | ( | ) |
Gets the current step position.
Definition at line 190 of file ProgressBar.php.
References ProgressBar\$step.
Referenced by ProgressBar\getStep(), ProgressBar\initPlaceholderFormatters(), and ProgressBarTest\testAddingPlaceholderFormatter().
getProgressCharacter | ( | ) |
Gets the progress bar character.
Definition at line 296 of file ProgressBar.php.
References ProgressBar\$progressChar.
Referenced by ProgressBar\initPlaceholderFormatters().
getProgressPercent | ( | ) |
Gets the current progress bar percent.
Definition at line 212 of file ProgressBar.php.
References ProgressBar\$percent.
Referenced by ProgressBar\initPlaceholderFormatters().
getStartTime | ( | ) |
Gets the progress bar start time.
Definition at line 156 of file ProgressBar.php.
References ProgressBar\$startTime.
Referenced by ProgressBar\initPlaceholderFormatters().
getStep | ( | ) |
Gets the progress bar step.
Definition at line 178 of file ProgressBar.php.
References ProgressBar\getProgress().
getStepWidth | ( | ) |
Gets the progress bar step width.
Definition at line 202 of file ProgressBar.php.
References ProgressBar\$stepWidth.
Referenced by ProgressBar\initPlaceholderFormatters().
|
staticprivate |
Definition at line 599 of file ProgressBar.php.
|
staticprivate |
Definition at line 542 of file ProgressBar.php.
References ProgressBar\$output, Helper\formatMemory(), Helper\formatTime(), ProgressBar\getBarCharacter(), ProgressBar\getBarWidth(), ProgressBar\getEmptyBarCharacter(), OutputInterface\getFormatter(), ProgressBar\getMaxSteps(), ProgressBar\getProgress(), ProgressBar\getProgressCharacter(), ProgressBar\getProgressPercent(), ProgressBar\getStartTime(), ProgressBar\getStepWidth(), and Helper\strlenWithoutDecoration().
|
private |
Overwrites a previous message to the output.
string | $message | The message |
Definition at line 492 of file ProgressBar.php.
References elseif, and Helper\strlenWithoutDecoration().
Referenced by ProgressBar\__construct(), ProgressBar\clear(), ProgressBar\display(), ProgressBar\finish(), and ProgressBar\setOverwrite().
setBarCharacter | ( | $char | ) |
Sets the bar character.
string | $char | A character |
Definition at line 242 of file ProgressBar.php.
Referenced by ProgressBarTest\testAnsiColorsAndEmojis().
setBarWidth | ( | $size | ) |
Sets the progress bar width.
int | $size | The progress bar size |
Definition at line 222 of file ProgressBar.php.
setCurrent | ( | $step | ) |
Sets the current progress.
int | $step | The current progress |
\LogicException |
Definition at line 369 of file ProgressBar.php.
References ProgressBar\$step, and ProgressBar\setProgress().
setEmptyBarCharacter | ( | $char | ) |
Sets the empty bar character.
string | $char | A character |
Definition at line 266 of file ProgressBar.php.
Referenced by ProgressBarTest\testAnsiColorsAndEmojis().
setFormat | ( | $format | ) |
Sets the progress bar format.
string | $format | The format |
Definition at line 306 of file ProgressBar.php.
References ProgressBar\$format, and elseif.
Referenced by ProgressBar\__construct(), and ProgressBarTest\testAnsiColorsAndEmojis().
|
static |
Sets a format for a given name.
This method also allow you to override an existing format.
string | $name | The format name |
string | $format | A format string |
Definition at line 116 of file ProgressBar.php.
References ProgressBar\$format.
|
private |
Sets the progress bar maximal steps.
int | The progress bar max steps |
Definition at line 481 of file ProgressBar.php.
References ProgressBar\$max, and Helper\strlen().
Referenced by ProgressBar\__construct(), and ProgressBar\start().
setMessage | ( | $message, | |
$name = 'message' |
|||
) |
Definition at line 141 of file ProgressBar.php.
Referenced by ProgressBarTest\testAnsiColorsAndEmojis().
setOverwrite | ( | $overwrite | ) |
Sets whether to overwrite the progressbar, false for new line.
bool | $overwrite |
Definition at line 381 of file ProgressBar.php.
References ProgressBar\$overwrite, and ProgressBar\overwrite().
|
static |
Sets a placeholder formatter for a given name.
This method also allow you to override an existing placeholder.
string | $name | The placeholder name (including the delimiter char like %) |
callable | $callable | A PHP callable |
Definition at line 83 of file ProgressBar.php.
Referenced by ProgressBarTest\testAddingPlaceholderFormatter(), and ProgressBarTest\testAnsiColorsAndEmojis().
setProgress | ( | $step | ) |
Sets the current progress.
int | $step | The current progress |
\LogicException |
Definition at line 393 of file ProgressBar.php.
References ProgressBar\$step, and ProgressBar\display().
Referenced by ProgressBar\advance(), ProgressBar\finish(), and ProgressBar\setCurrent().
setProgressCharacter | ( | $char | ) |
Sets the progress bar character.
string | $char | A character |
Definition at line 286 of file ProgressBar.php.
Referenced by ProgressBarTest\testAnsiColorsAndEmojis().
setRedrawFrequency | ( | $freq | ) |
Sets the redraw frequency.
int | $freq | The frequency in steps |
Definition at line 325 of file ProgressBar.php.
Referenced by ProgressBar\__construct().
start | ( | $max = null | ) |
Starts the progress output.
int | null | $max | Number of steps to complete the bar (0 if indeterminate), null to leave unchanged |
Definition at line 335 of file ProgressBar.php.
References ProgressBar\$max, ProgressBar\display(), and ProgressBar\setMaxSteps().
Referenced by ProgressBarTest\testAnsiColorsAndEmojis().
|
private |
Definition at line 26 of file ProgressBar.php.
Referenced by ProgressBar\getBarCharacter().
|
private |
Definition at line 25 of file ProgressBar.php.
Referenced by ProgressBar\getBarWidth().
|
private |
Definition at line 27 of file ProgressBar.php.
Referenced by ProgressBar\getBarCharacter(), and ProgressBar\getEmptyBarCharacter().
|
private |
Definition at line 29 of file ProgressBar.php.
Referenced by ProgressBar\display(), ProgressBar\setFormat(), and ProgressBar\setFormatDefinition().
|
private |
Definition at line 42 of file ProgressBar.php.
|
staticprivate |
Definition at line 47 of file ProgressBar.php.
|
staticprivate |
Definition at line 46 of file ProgressBar.php.
|
private |
Definition at line 41 of file ProgressBar.php.
|
private |
Definition at line 37 of file ProgressBar.php.
Referenced by ProgressBar\__construct(), ProgressBar\getMaxSteps(), ProgressBar\setMaxSteps(), and ProgressBar\start().
|
private |
Definition at line 43 of file ProgressBar.php.
Referenced by ProgressBar\display().
|
private |
Definition at line 35 of file ProgressBar.php.
Referenced by ProgressBar\__construct(), ProgressBar\display(), and ProgressBar\initPlaceholderFormatters().
|
private |
Definition at line 44 of file ProgressBar.php.
Referenced by ProgressBar\setOverwrite().
|
private |
Definition at line 40 of file ProgressBar.php.
Referenced by ProgressBar\getProgressPercent().
|
private |
Definition at line 28 of file ProgressBar.php.
Referenced by ProgressBar\getProgressCharacter().
|
private |
Definition at line 30 of file ProgressBar.php.
|
private |
Definition at line 38 of file ProgressBar.php.
Referenced by ProgressBar\getStartTime().
|
private |
Definition at line 36 of file ProgressBar.php.
Referenced by ProgressBar\advance(), ProgressBar\finish(), ProgressBar\getProgress(), ProgressBar\setCurrent(), and ProgressBar\setProgress().
|
private |
Definition at line 39 of file ProgressBar.php.
Referenced by ProgressBar\getStepWidth().