PHP Class ConsoleKit\Widgets\ProgressBar

$total = 100; $progress = new ProgressBar($textWriter, $total); for ($i = 0; $i < $total; $i++) { $progress->incr(); usleep(10000); } $progress->stop();
Inheritance: extends AbstractWidget
Show file Open project: maximebf/consolekit Class Usage Examples

Protected Properties

Property Type Description
$showRemainingTime boolean
$size integer
$startTime integer
$total integer
$value integer

Public Methods

Method Description
__construct ( ConsoleKit\TextWriter $writer = null, integer $total = 100, integer $size = 50, $showRemainingTime = true )
__toString ( )
getShowRemainingTime ( ) : boolean
getSize ( ) : integer
getValue ( ) : number
incr ( integer $increment = 1 ) : ProgressBar Increments the value and calls {@see write()}
render ( ) : string Generates the text to write for the current values
setShowRemainingTime ( boolean $show = true )
setSize ( integer $size ) : ProgressBar
setValue ( number $value )
start ( integer $total = 100 ) : ProgressBar
stop ( ) : ProgressBar Writes a new line
write ( ) : ProgressBar Writes the rendered progress bar to the text writer

Method Details

__construct() public method

public __construct ( ConsoleKit\TextWriter $writer = null, integer $total = 100, integer $size = 50, $showRemainingTime = true )
$writer ConsoleKit\TextWriter
$total integer
$size integer

__toString() public method

public __toString ( )

getShowRemainingTime() public method

public getShowRemainingTime ( ) : boolean
return boolean

getSize() public method

public getSize ( ) : integer
return integer

getValue() public method

public getValue ( ) : number
return number

incr() public method

Increments the value and calls {@see write()}
public incr ( integer $increment = 1 ) : ProgressBar
$increment integer
return ProgressBar

render() public method

Generates the text to write for the current values
public render ( ) : string
return string

setShowRemainingTime() public method

public setShowRemainingTime ( boolean $show = true )
$show boolean

setSize() public method

public setSize ( integer $size ) : ProgressBar
$size integer
return ProgressBar

setValue() public method

public setValue ( number $value )
$value number

start() public method

public start ( integer $total = 100 ) : ProgressBar
$total integer
return ProgressBar

stop() public method

Writes a new line
public stop ( ) : ProgressBar
return ProgressBar

write() public method

Writes the rendered progress bar to the text writer
public write ( ) : ProgressBar
return ProgressBar

Property Details

$showRemainingTime protected property

protected bool $showRemainingTime
return boolean

$size protected property

protected int $size
return integer

$startTime protected property

protected int $startTime
return integer

$total protected property

protected int $total
return integer

$value protected property

protected int $value
return integer