|
26 | 26 | */ |
27 | 27 | final class ProgressBar |
28 | 28 | { |
| 29 | + public const FORMAT_VERBOSE = 'verbose'; |
| 30 | + public const FORMAT_VERY_VERBOSE = 'very_verbose'; |
| 31 | + public const FORMAT_DEBUG = 'debug'; |
| 32 | + public const FORMAT_NORMAL = 'normal'; |
| 33 | + |
| 34 | + private const FORMAT_VERBOSE_NOMAX = 'verbose_nomax'; |
| 35 | + private const FORMAT_VERY_VERBOSE_NOMAX = 'very_verbose_nomax'; |
| 36 | + private const FORMAT_DEBUG_NOMAX = 'debug_nomax'; |
| 37 | + private const FORMAT_NORMAL_NOMAX = 'normal_nomax'; |
| 38 | + |
29 | 39 | private $barWidth = 28; |
30 | 40 | private $barChar; |
31 | 41 | private $emptyBarChar = '-'; |
@@ -489,13 +499,13 @@ private function determineBestFormat(): string |
489 | 499 | switch ($this->output->getVerbosity()) { |
490 | 500 | // OutputInterface::VERBOSITY_QUIET: display is disabled anyway |
491 | 501 | case OutputInterface::VERBOSITY_VERBOSE: |
492 | | - return $this->max ? 'verbose' : 'verbose_nomax'; |
| 502 | + return $this->max ? self::FORMAT_VERBOSE : self::FORMAT_VERBOSE_NOMAX; |
493 | 503 | case OutputInterface::VERBOSITY_VERY_VERBOSE: |
494 | | - return $this->max ? 'very_verbose' : 'very_verbose_nomax'; |
| 504 | + return $this->max ? self::FORMAT_VERY_VERBOSE : self::FORMAT_VERY_VERBOSE_NOMAX; |
495 | 505 | case OutputInterface::VERBOSITY_DEBUG: |
496 | | - return $this->max ? 'debug' : 'debug_nomax'; |
| 506 | + return $this->max ? self::FORMAT_DEBUG : self::FORMAT_DEBUG_NOMAX; |
497 | 507 | default: |
498 | | - return $this->max ? 'normal' : 'normal_nomax'; |
| 508 | + return $this->max ? self::FORMAT_NORMAL : self::FORMAT_NORMAL_NOMAX; |
499 | 509 | } |
500 | 510 | } |
501 | 511 |
|
@@ -547,17 +557,17 @@ private static function initPlaceholderFormatters(): array |
547 | 557 | private static function initFormats(): array |
548 | 558 | { |
549 | 559 | return [ |
550 | | - 'normal' => ' %current%/%max% [%bar%] %percent:3s%%', |
551 | | - 'normal_nomax' => ' %current% [%bar%]', |
| 560 | + self::FORMAT_NORMAL => ' %current%/%max% [%bar%] %percent:3s%%', |
| 561 | + self::FORMAT_NORMAL_NOMAX => ' %current% [%bar%]', |
552 | 562 |
|
553 | | - 'verbose' => ' %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%', |
554 | | - 'verbose_nomax' => ' %current% [%bar%] %elapsed:6s%', |
| 563 | + self::FORMAT_VERBOSE => ' %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%', |
| 564 | + self::FORMAT_VERBOSE_NOMAX => ' %current% [%bar%] %elapsed:6s%', |
555 | 565 |
|
556 | | - 'very_verbose' => ' %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%/%estimated:-6s%', |
557 | | - 'very_verbose_nomax' => ' %current% [%bar%] %elapsed:6s%', |
| 566 | + self::FORMAT_VERY_VERBOSE => ' %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%/%estimated:-6s%', |
| 567 | + self::FORMAT_VERY_VERBOSE_NOMAX => ' %current% [%bar%] %elapsed:6s%', |
558 | 568 |
|
559 | | - 'debug' => ' %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%/%estimated:-6s% %memory:6s%', |
560 | | - 'debug_nomax' => ' %current% [%bar%] %elapsed:6s% %memory:6s%', |
| 569 | + self::FORMAT_DEBUG => ' %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%/%estimated:-6s% %memory:6s%', |
| 570 | + self::FORMAT_DEBUG_NOMAX => ' %current% [%bar%] %elapsed:6s% %memory:6s%', |
561 | 571 | ]; |
562 | 572 | } |
563 | 573 |
|
|
0 commit comments