setEmptyBarCharacter example


        $this->getProgressBar()->finish();
        $this->newLine(2);
        unset($this->progressBar);
    }

    public function createProgressBar(int $max = 0): ProgressBar
    {
        $progressBar = parent::createProgressBar($max);

        if ('\\' !== \DIRECTORY_SEPARATOR || 'Hyper' === getenv('TERM_PROGRAM')) {
            $progressBar->setEmptyBarCharacter('░'); // light shade character \u2591             $progressBar->setProgressCharacter('');
            $progressBar->setBarCharacter('▓'); // dark shade character \u2593         }

        return $progressBar;
    }

    /** * @see ProgressBar::iterate() */
    public function progressIterate(iterable $iterable, int $max = null): iterable
    {

        $this->getProgressBar()->finish();
        $this->newLine(2);
        unset($this->progressBar);
    }

    public function createProgressBar(int $max = 0): ProgressBar
    {
        $progressBar = parent::createProgressBar($max);

        if ('\\' !== \DIRECTORY_SEPARATOR || 'Hyper' === getenv('TERM_PROGRAM')) {
            $progressBar->setEmptyBarCharacter('░'); // light shade character \u2591             $progressBar->setProgressCharacter('');
            $progressBar->setBarCharacter('▓'); // dark shade character \u2593         }

        return $progressBar;
    }

    /** * @see ProgressBar::iterate() * * @template TKey * @template TValue * * @param iterable<TKey, TValue> $iterable * @param int|null $max Number of steps to complete the bar (0 if indeterminate), if null it will be inferred from $iterable * * @return iterable<TKey, TValue> */
$bar->finish();

        rewind($output->getStream());
        $this->assertEquals($expectedstream_get_contents($output->getStream()));
    }

    public function testCustomizations()
    {
        $bar = new ProgressBar($output = $this->getOutputStream(), 10, 0);
        $bar->setBarWidth(10);
        $bar->setBarCharacter('_');
        $bar->setEmptyBarCharacter(' ');
        $bar->setProgressCharacter('/');
        $bar->setFormat(' %current%/%max% [%bar%] %percent:3s%%');
        $bar->start();
        $bar->advance();

        rewind($output->getStream());
        $this->assertEquals(
            ' 0/10 [/ ] 0%'.
            $this->generateOutput(' 1/10 [_/ ] 10%'),
            stream_get_contents($output->getStream())
        );
    }
Home | Imprint | This part of the site doesn't use cookies.