$total = 100;
$progress = new ProgressBar($textWriter, $total);
for ($i = 0; $i < $total; $i++) {
$progress->incr();
usleep(10000);
}
$progress->stop();
Показать файл
Открыть проект
Примеры использования класса
Свойство | Тип | Описание | |
---|---|---|---|
$showRemainingTime | boolean | ||
$size | integer | ||
$startTime | integer | ||
$total | integer | ||
$value | integer |
Метод | Описание | |
---|---|---|
__construct ( ConsoleKit\TextWriter $writer = null, integer $total = 100, integer $size = 50, $showRemainingTime = true ) | ||
__toString ( ) | ||
getShowRemainingTime ( ) : boolean | ||
getSize ( ) : integer | ||
getValue ( ) : number | ||
incr ( integer $increment = 1 ) : |
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 ) : |
||
setValue ( number $value ) | ||
start ( integer $total = 100 ) : |
||
stop ( ) : |
Writes a new line | |
write ( ) : |
Writes the rendered progress bar to the text writer |
public __construct ( ConsoleKit\TextWriter $writer = null, integer $total = 100, integer $size = 50, $showRemainingTime = true ) | ||
$writer | ConsoleKit\TextWriter | |
$total | integer | |
$size | integer |
public setShowRemainingTime ( boolean $show = true ) | ||
$show | boolean |
public write ( ) : |
||
Результат |