Neuron-PHP

ProgressBar
in package

Progress bar for displaying task progress in the CLI.

Table of Contents

Properties

$current  : int
$format  : string
$output  : Output
$startTime  : float
$total  : int
$width  : int

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

$format

private string $format = ' [%bar%] %percent%% %current%/%total% %elapsed% / %estimated%'

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
float

getProgress()

Get the current progress

public getProgress() : int
Return values
int

getTotal()

Get the total steps

public getTotal() : int
Return values
int

setFormat()

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
Return values
string

        
On this page

Search results