$total = 100;
$progress = new ProgressBar($textWriter, $total);
for ($i = 0; $i < $total; $i++) {
$progress->incr();
usleep(10000);
}
$progress->stop();
/** * Displays a progress bar * * @opt total Number of iterations * @opt usleep Waiting time in microsecond between each iteration */ function progress($args, $options, $console) { $total = isset($options['total']) ? $options['total'] : 100; $usleep = isset($options['usleep']) ? $options['usleep'] : 10000; $progress = new ProgressBar($console, $total); for ($i = 0; $i < $total; $i++) { $progress->incr(); usleep($usleep); } $progress->stop(); }