ConsoleKit\Widgets\ProgressBar::stop PHP Method

stop() public method

Writes a new line
public stop ( ) : ProgressBar
return ProgressBar
    public function stop()
    {
        $this->textWriter->writeln();
        return $this;
    }

Usage Example

Esempio n. 1
0
/**
 * 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();
}