Symfony\Component\Console\Helper\ProgressBar::getFormatDefinition PHP Method

getFormatDefinition() public static method

Gets the format for a given name.
public static getFormatDefinition ( string $name ) : string | null
$name string The format name
return string | null A format string
    public static function getFormatDefinition($name)
    {
        if (!self::$formats) {
            self::$formats = self::initFormats();
        }
        return isset(self::$formats[$name]) ? self::$formats[$name] : null;
    }

Usage Example

コード例 #1
0
 /**
  * @param int $count
  * @param int $minVerbosity
  *
  * @return ProgressBar
  */
 public function createProgressBar($count, $minVerbosity = OutputInterface::VERBOSITY_NORMAL)
 {
     $stream = new NullOutput();
     if ($this->applicationInput->hasOption('progress') && $this->applicationInput->getOption('progress')) {
         if ($this->applicationOutput instanceof ConsoleOutput) {
             if ($this->applicationOutput->getVerbosity() >= $minVerbosity) {
                 $stream = $this->applicationOutput->getErrorOutput();
             }
         }
     }
     $progress = new ProgressBar($stream, $count);
     // add an additional space, in case logging is also enabled
     $progress->setFormat($progress->getFormatDefinition('normal') . ' ');
     $progress->start();
     return $progress;
 }
All Usage Examples Of Symfony\Component\Console\Helper\ProgressBar::getFormatDefinition