Symfony\Component\Console\Style\SymfonyStyle::createProgressBar PHP Method

createProgressBar() public method

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

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

        return $progressBar;
    }

Usage Example

Example #1
0
 /**
  * Create a styled progress bar
  *
  * @param  integer $max Max value for the progress bar
  * @return \Symfony\Component\Console\Helper\ProgressBar
  */
 protected function create_progress_bar($max)
 {
     $progress = $this->io->createProgressBar($max);
     if ($this->output->getVerbosity() === OutputInterface::VERBOSITY_VERBOSE) {
         $progress->setFormat('<info>[%percent:3s%%]</info> %message%');
         $progress->setOverwrite(false);
     } else {
         if ($this->output->getVerbosity() >= OutputInterface::VERBOSITY_VERY_VERBOSE) {
             $progress->setFormat('<info>[%current:s%/%max:s%]</info><comment>[%elapsed%/%estimated%][%memory%]</comment> %message%');
             $progress->setOverwrite(false);
         } else {
             $this->io->newLine(2);
             $progress->setFormat("    %current:s%/%max:s% %bar%  %percent:3s%%\n" . "        %message% %elapsed:6s%/%estimated:-6s% %memory:6s%\n");
             $progress->setBarWidth(60);
         }
     }
     if (!defined('PHP_WINDOWS_VERSION_BUILD')) {
         $progress->setEmptyBarCharacter('░');
         // light shade character \u2591
         $progress->setProgressCharacter('');
         $progress->setBarCharacter('▓');
         // dark shade character \u2593
     }
     return $progress;
 }
All Usage Examples Of Symfony\Component\Console\Style\SymfonyStyle::createProgressBar