Methods |
public
|
__construct(OutputInterface $output, int $max = 0, float $minSecondsBetweenRedraws = 1 / 25)
Parameters
$max |
Maximum steps (0 if unknown)
|
|
#
|
public
static
|
setPlaceholderFormatterDefinition(string $name, callable(ProgressBar): string $callable): void
Sets a placeholder formatter for a given name, globally for all instances of ProgressBar. This method also allow you to override an existing placeholder.
Sets a placeholder formatter for a given name, globally for all instances of ProgressBar. This method also allow you to override an existing placeholder.
Parameters
$name |
The placeholder name (including the delimiter char like %)
|
$callable |
A PHP callable
|
|
#
|
public
static
|
getPlaceholderFormatterDefinition(string $name): ?callable
Gets the placeholder formatter for a given name.
Gets the placeholder formatter for a given name.
Parameters
$name |
The placeholder name (including the delimiter char like %)
|
|
#
|
public
|
setPlaceholderFormatter(string $name, callable(ProgressBar): string $callable): void
Sets a placeholder formatter for a given name, for this instance only.
Sets a placeholder formatter for a given name, for this instance only.
Parameters
|
#
|
public
|
getPlaceholderFormatter(string $name): ?callable
Gets the placeholder formatter for a given name.
Gets the placeholder formatter for a given name.
Parameters
$name |
The placeholder name (including the delimiter char like %)
|
|
#
|
public
static
|
setFormatDefinition(string $name, string $format): void
Sets a format for a given name. This method also allow you to override an existing format.
Sets a format for a given name. This method also allow you to override an existing format.
Parameters
$name |
The format name
|
$format |
A format string
|
|
#
|
public
static
|
getFormatDefinition(string $name): ?string
Gets the format for a given name.
Gets the format for a given name.
Parameters
|
#
|
public
|
setMessage(string $message, string $name = 'message'): void
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 %).
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 %).
Parameters
$message |
The text to associate with the placeholder
|
$name |
The name of the placeholder
|
|
#
|
public
|
getMessage(string $name = 'message'): ?string
|
#
|
public
|
getStartTime(): int
|
#
|
public
|
getMaxSteps(): int
|
#
|
public
|
getProgress(): int
|
#
|
public
|
getProgressPercent(): float
|
#
|
public
|
getBarOffset(): float
|
#
|
public
|
getEstimated(): float
|
#
|
public
|
getRemaining(): float
|
#
|
public
|
setBarWidth(int $size): void
|
#
|
public
|
getBarWidth(): int
|
#
|
public
|
setBarCharacter(string $char): void
|
#
|
public
|
getBarCharacter(): string
|
#
|
public
|
setEmptyBarCharacter(string $char): void
|
#
|
public
|
getEmptyBarCharacter(): string
|
#
|
public
|
setProgressCharacter(string $char): void
|
#
|
public
|
getProgressCharacter(): string
|
#
|
public
|
setFormat(string $format): void
|
#
|
public
|
setRedrawFrequency(int|null $freq): void
Sets the redraw frequency.
Sets the redraw frequency.
Parameters
$freq |
The frequency in steps
|
|
#
|
public
|
minSecondsBetweenRedraws(float $seconds): void
|
#
|
public
|
maxSecondsBetweenRedraws(float $seconds): void
|
#
|
public
|
iterate<TKey, TValue>(iterable<TKey, TValue> $iterable, int|null $max = null): iterable<TKey, TValue>
Returns an iterator that will automatically update the progress bar when iterated.
Returns an iterator that will automatically update the progress bar when iterated.
Parameters
$max |
Number of steps to complete the bar (0 if indeterminate), if null it will be inferred from $iterable
|
|
#
|
public
|
start(int|null $max = null, int $startAt = 0): void
Starts the progress output.
Starts the progress output.
Parameters
$max |
Number of steps to complete the bar (0 if indeterminate), null to leave unchanged
|
$startAt |
The starting point of the bar (useful e.g. when resuming a previously started bar)
|
|
#
|
public
|
advance(int $step = 1): void
Advances the progress output X steps.
Advances the progress output X steps.
Parameters
$step |
Number of steps to advance
|
|
#
|
public
|
setOverwrite(bool $overwrite): void
Sets whether to overwrite the progressbar, false for new line.
Sets whether to overwrite the progressbar, false for new line.
|
#
|
public
|
setProgress(int $step): void
|
#
|
public
|
setMaxSteps(int $max): void
|
#
|
public
|
finish(): void
Finishes the progress output.
Finishes the progress output.
|
#
|
public
|
display(): void
Outputs the current progress string.
Outputs the current progress string.
|
#
|
public
|
clear(): void
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.
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.
|
#
|