当前位置: 首页>>代码示例>>PHP>>正文


PHP ProgressBar::setFormatDefinition方法代码示例

本文整理汇总了PHP中Symfony\Component\Console\Helper\ProgressBar::setFormatDefinition方法的典型用法代码示例。如果您正苦于以下问题:PHP ProgressBar::setFormatDefinition方法的具体用法?PHP ProgressBar::setFormatDefinition怎么用?PHP ProgressBar::setFormatDefinition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Symfony\Component\Console\Helper\ProgressBar的用法示例。


在下文中一共展示了ProgressBar::setFormatDefinition方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: initialize

 /**
  * {@inheritDoc}
  */
 protected function initialize(InputInterface $input, OutputInterface $output)
 {
     $this->em = $this->getEntityManager();
     if (class_exists('Symfony\\Component\\Console\\Helper\\ProgressBar')) {
         ProgressBar::setFormatDefinition('normal', " %current%/%max% [%bar%] %percent:3s%%\n%message%");
         ProgressBar::setFormatDefinition('verbose', " %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%\n%message%");
         ProgressBar::setFormatDefinition('very_verbose', " %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%/%estimated:-6s%\n%message%");
         ProgressBar::setFormatDefinition('debug', " %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%/%estimated:-6s% %memory:6s%\n%message%");
     }
 }
开发者ID:Opifer,项目名称:Cms,代码行数:13,代码来源:SyncSubscriptionCommand.php

示例2: setupFormat

 /**
  * @return void
  */
 protected function setupFormat()
 {
     ProgressBar::setFormatDefinition('normal_nomax', ' <fg=yellow>*</fg=yellow> <fg=green>%barTitle%</fg=green> <fg=yellow>(%max%)</fg=yellow>');
     ProgressBar::setFormatDefinition('verbose_nomax', ' <fg=yellow>*</fg=yellow> <fg=green>%barTitle%</fg=green> <fg=yellow>(%max%)</fg=yellow>');
     ProgressBar::setFormatDefinition('very_verbose_nomax', ' <fg=yellow>*</fg=yellow> <fg=green>%barTitle%</fg=green> <fg=yellow>(%max%)</fg=yellow>');
     ProgressBar::setFormatDefinition('debug_nomax', ' <fg=yellow>*</fg=yellow> <fg=green>%barTitle%</fg=green> <fg=yellow>(%max%)</fg=yellow>');
     ProgressBar::setFormatDefinition('normal', ' <fg=yellow>*</fg=yellow> <fg=green>%barTitle%</fg=green> <fg=yellow>(%max%)</fg=yellow>');
     ProgressBar::setFormatDefinition('verbose', ' <fg=yellow>*</fg=yellow> <fg=green>%barTitle%</fg=green> <fg=yellow>%percent%% (%current%/%max%) %elapsed:6s%</fg=yellow>');
     ProgressBar::setFormatDefinition('very_verbose', " <fg=yellow>*</fg=yellow> <fg=green>%barTitle:-25s%</fg=green> [%bar%] <fg=yellow>%percent%% (%current%/%max%) %elapsed:6s% %memory:6s%</fg=yellow>\r");
     ProgressBar::setFormatDefinition('debug', " <fg=yellow>*</fg=yellow> <fg=green>%barTitle:-25s%</fg=green> %bar% <fg=yellow>%percent:20s%% [%current%/%max%] Memory: %memory%, Elapsed: %elapsed%, Remaining: %remaining%</fg=yellow>\r");
 }
开发者ID:spryker,项目名称:Gui,代码行数:14,代码来源:ProgressBarBuilder.php

示例3: initialize

 /**
  * {@inheritDoc}
  */
 protected function initialize(InputInterface $input, OutputInterface $output)
 {
     $this->dispatcher = $this->getContainer()->get('event_dispatcher');
     $this->indexManager = $this->getContainer()->get('fos_elastica.index_manager');
     $this->providerRegistry = $this->getContainer()->get('fos_elastica.provider_registry');
     $this->resetter = $this->getContainer()->get('fos_elastica.resetter');
     $this->progressClosureBuilder = new ProgressClosureBuilder();
     if (!$input->getOption('no-overwrite-format') && class_exists('Symfony\\Component\\Console\\Helper\\ProgressBar')) {
         ProgressBar::setFormatDefinition('normal', " %current%/%max% [%bar%] %percent:3s%%\n%message%");
         ProgressBar::setFormatDefinition('verbose', " %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%\n%message%");
         ProgressBar::setFormatDefinition('very_verbose', " %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%/%estimated:-6s%\n%message%");
         ProgressBar::setFormatDefinition('debug', " %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%/%estimated:-6s% %memory:6s%\n%message%");
     }
 }
开发者ID:anteros,项目名称:FOSElasticaBundle,代码行数:17,代码来源:PopulateCommand.php

示例4: __construct

 /**
  * Initializes a new instance of the Reporter class.
  *
  * @param  $output
  * @param  $total
  *
  * @return Reporter
  */
 public function __construct(OutputInterface $output, $total)
 {
     $this->issues = new IssueCollection();
     $this->output = $output;
     if ($total > 1) {
         $this->output->writeln('');
         ProgressBar::setFormatDefinition('minimal', ' <fg=cyan>Reviewing file %current% of %max%.</>');
         $this->progress = new ProgressBar($output, $total);
         $this->progress->setFormat('minimal');
         $this->progress->start();
     }
     $this->total = $total;
     $this->current = 1;
 }
开发者ID:edetaillac,项目名称:static-review,代码行数:22,代码来源:Reporter.php

示例5: __construct

 /**
  * TerminusStyle constructor.
  *
  * @param \Symfony\Component\Console\Input\InputInterface $input
  * @param \Symfony\Component\Console\Output\OutputInterface $output
  */
 public function __construct(InputInterface $input, OutputInterface $output)
 {
     ProgressBar::setFormatDefinition('normal', self::NORMAL_PROGRESS_FORMAT);
     parent::__construct($input, $output);
 }
开发者ID:pantheon-systems,项目名称:terminus,代码行数:11,代码来源:TerminusStyle.php

示例6: copyTable

 protected function copyTable($table, $keyColumn = false)
 {
     $columns = join(array_map(function ($column) {
         return $this->sc->quoteIdentifier($column->getName());
     }, $table->getColumns()), ',');
     $sqlParameters = array();
     $maxKey = null;
     // set selection range
     if ($keyColumn) {
         $sqlMax = 'SELECT MAX(' . $this->tc->quoteIdentifier($keyColumn) . ') ' . 'FROM ' . $this->tc->quoteIdentifier($table->getName());
         $maxKey = $this->tc->fetchColumn($sqlMax);
         if (isset($maxKey)) {
             $sqlParameters[] = $maxKey;
         }
     } else {
         // clear target table
         $this->truncateTable($this->tc, $table);
     }
     echo $table->getName() . ": copying ";
     // count selection range
     $sqlCount = 'SELECT COUNT(1) FROM (' . $this->sc->quoteIdentifier($table->getName()) . ')';
     if ($keyColumn && isset($maxKey)) {
         $sqlCount .= ' WHERE ' . $this->sc->quoteIdentifier($keyColumn) . ' > ?';
     }
     $totalRows = $this->sc->fetchColumn($sqlCount, $sqlParameters);
     echo $totalRows . " rows (" . ($keyColumn ? 'partial copy' : 'overwrite') . ")\n";
     $progress = new ProgressBar($this->output, $totalRows);
     $progress->setFormatDefinition('debug', ' [%bar%] %percent:3s%% %elapsed:8s%/%estimated:-8s% %current% rows');
     $progress->setFormat('debug');
     $freq = (int) $totalRows / 20;
     $progress->setRedrawFrequency($freq > 10 ? $freq : 10);
     $progress->start();
     // transfer sql
     $sqlValuePlaceholder = '(' . join(array_fill(0, sizeof($table->getColumns()), '?'), ',') . ')';
     $loopOffsetIndex = 0;
     do {
         // get source data
         $sql = 'SELECT ' . $columns . ' FROM ' . $this->sc->quoteIdentifier($table->getName());
         // limit selection for PRIMARY KEY mode
         if ($keyColumn) {
             if (isset($maxKey)) {
                 $sql .= ' WHERE ' . $this->sc->quoteIdentifier($keyColumn) . ' > ?';
                 $sqlParameters = array($maxKey);
             }
             $sql .= ' ORDER BY ' . $this->sc->quoteIdentifier($keyColumn) . ' LIMIT ' . $this->batch;
         } else {
             $sql .= ' LIMIT ' . $this->batch . ' OFFSET ' . $this->batch * $loopOffsetIndex++;
         }
         if (sizeof($rows = $this->sc->fetchAll($sql, $sqlParameters)) == 0) {
             // avoid div by zero in progress->advance
             break;
         }
         if ($this->tc->getDatabasePlatform()->getName() !== 'sqlite') {
             $sqlInsert = 'INSERT INTO ' . $this->tc->quoteIdentifier($table->getName()) . ' (' . $columns . ') ' . 'VALUES ' . join(array_fill(0, count($rows), $sqlValuePlaceholder), ',');
             $data = array();
             foreach ($rows as $row) {
                 // remember max key
                 if ($keyColumn) {
                     $maxKey = $row[$keyColumn];
                 }
                 $data = array_merge($data, array_values($row));
             }
             $this->tc->executeUpdate($sqlInsert, $data);
             $progress->advance(count($rows));
         } else {
             // sqlite
             $stmt = $this->tc->prepare('INSERT INTO ' . $this->tc->quoteIdentifier($table->getName()) . ' (' . $columns . ') ' . 'VALUES (' . join(array_fill(0, count($table->getColumns()), '?'), ',') . ')');
             $this->tc->beginTransaction();
             foreach ($rows as $row) {
                 // remember max key
                 if ($keyColumn) {
                     $maxKey = $row[$keyColumn];
                 }
                 $stmt->execute(array_values($row));
                 $progress->advance(1);
             }
             $this->tc->commit();
         }
     } while ($keyColumn && sizeof($rows));
     $progress->finish();
     echo "\n\n";
     // CRLF after progressbar @ 100%
 }
开发者ID:andig,项目名称:dbcopy,代码行数:83,代码来源:BackupCommand.php


注:本文中的Symfony\Component\Console\Helper\ProgressBar::setFormatDefinition方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。