ProgressBar
in package
Progress bar for displaying task progress in the CLI.
Table of Contents
Properties
Methods
- __construct() : mixed
- advance() : void
- Advance the progress bar by a number of steps
- finish() : void
- Finish the progress bar
- getPercentage() : float
- Get the percentage complete
- getProgress() : int
- Get the current progress
- getTotal() : int
- Get the total steps
- setFormat() : void
- Set the format of the progress bar
- setProgress() : void
- Set the current progress
- setWidth() : void
- Set the width of the progress bar
- start() : void
- Start the progress bar
- display() : void
- Display the progress bar
- formatTime() : string
- Format time in seconds to human-readable format
Properties
$current
private
int
$current
= 0
$format
private
string
$format
= ' [%bar%] %percent%% %current%/%total% %elapsed% / %estimated%'
$output
private
Output
$output
$startTime
private
float
$startTime
$total
private
int
$total
$width
private
int
$width
= 50
Methods
__construct()
public
__construct(Output $output, int $total) : mixed
Parameters
- $output : Output
- $total : int
-
Total number of steps
advance()
Advance the progress bar by a number of steps
public
advance([int $steps = 1 ]) : void
Parameters
- $steps : int = 1
finish()
Finish the progress bar
public
finish() : void
getPercentage()
Get the percentage complete
public
getPercentage() : float
Return values
floatgetProgress()
Get the current progress
public
getProgress() : int
Return values
intgetTotal()
Get the total steps
public
getTotal() : int
Return values
intsetFormat()
Set the format of the progress bar
public
setFormat(string $format) : void
Parameters
- $format : string
setProgress()
Set the current progress
public
setProgress(int $current) : void
Parameters
- $current : int
setWidth()
Set the width of the progress bar
public
setWidth(int $width) : void
Parameters
- $width : int
start()
Start the progress bar
public
start() : void
display()
Display the progress bar
private
display() : void
formatTime()
Format time in seconds to human-readable format
private
formatTime(float $seconds) : string
Parameters
- $seconds : float