|
26 | 26 | */
|
27 | 27 | final class ProgressBar
|
28 | 28 | {
|
29 |
| - public const VERBOSE = 'verbose'; |
30 |
| - public const VERY_VERBOSE = 'very_verbose'; |
31 |
| - public const DEBUG = 'debug'; |
32 |
| - public const NORMAL = 'normal'; |
| 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 | 33 |
|
34 |
| - private const VERBOSE_NOMAX = 'verbose_nomax'; |
35 |
| - private const VERY_VERBOSE_NOMAX = 'very_verbose_nomax'; |
36 |
| - private const DEBUG_NOMAX = 'debug_nomax'; |
37 |
| - private const NORMAL_NOMAX = 'normal_nomax'; |
38 |
| - private const NOMAX_SUFIX = '_nomax'; |
| 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 | + private const FORMAT_NOMAX_SUFIX = '_nomax'; |
39 | 39 |
|
40 | 40 | private $barWidth = 28;
|
41 | 41 | private $barChar;
|
@@ -448,8 +448,8 @@ public function clear(): void
|
448 | 448 | private function setRealFormat(string $format)
|
449 | 449 | {
|
450 | 450 | // try to use the _nomax variant if available
|
451 |
| - if (!$this->max && null !== self::getFormatDefinition($format.self::NOMAX_SUFIX)) { |
452 |
| - $this->format = self::getFormatDefinition($format.self::NOMAX_SUFIX); |
| 451 | + if (!$this->max && null !== self::getFormatDefinition($format.self::FORMAT_NOMAX_SUFIX)) { |
| 452 | + $this->format = self::getFormatDefinition($format.self::FORMAT_NOMAX_SUFIX); |
453 | 453 | } elseif (null !== self::getFormatDefinition($format)) {
|
454 | 454 | $this->format = self::getFormatDefinition($format);
|
455 | 455 | } else {
|
@@ -500,13 +500,13 @@ private function determineBestFormat(): string
|
500 | 500 | switch ($this->output->getVerbosity()) {
|
501 | 501 | // OutputInterface::VERBOSITY_QUIET: display is disabled anyway
|
502 | 502 | case OutputInterface::VERBOSITY_VERBOSE:
|
503 |
| - return $this->max ? self::VERBOSE : self::VERBOSE_NOMAX; |
| 503 | + return $this->max ? self::FORMAT_VERBOSE : self::FORMAT_VERBOSE_NOMAX; |
504 | 504 | case OutputInterface::VERBOSITY_VERY_VERBOSE:
|
505 |
| - return $this->max ? self::VERY_VERBOSE : self::VERY_VERBOSE_NOMAX; |
| 505 | + return $this->max ? self::FORMAT_VERY_VERBOSE : self::FORMAT_VERY_VERBOSE_NOMAX; |
506 | 506 | case OutputInterface::VERBOSITY_DEBUG:
|
507 |
| - return $this->max ? self::DEBUG : self::DEBUG_NOMAX; |
| 507 | + return $this->max ? self::FORMAT_DEBUG : self::FORMAT_DEBUG_NOMAX; |
508 | 508 | default:
|
509 |
| - return $this->max ? self::NORMAL : self::NORMAL_NOMAX; |
| 509 | + return $this->max ? self::FORMAT_NORMAL : self::FORMAT_NORMAL_NOMAX; |
510 | 510 | }
|
511 | 511 | }
|
512 | 512 |
|
@@ -558,17 +558,17 @@ private static function initPlaceholderFormatters(): array
|
558 | 558 | private static function initFormats(): array
|
559 | 559 | {
|
560 | 560 | return [
|
561 |
| - self::NORMAL => ' %current%/%max% [%bar%] %percent:3s%%', |
562 |
| - self::NORMAL_NOMAX => ' %current% [%bar%]', |
| 561 | + self::FORMAT_NORMAL => ' %current%/%max% [%bar%] %percent:3s%%', |
| 562 | + self::FORMAT_NORMAL_NOMAX => ' %current% [%bar%]', |
563 | 563 |
|
564 |
| - self::VERBOSE => ' %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%', |
565 |
| - self::VERBOSE_NOMAX => ' %current% [%bar%] %elapsed:6s%', |
| 564 | + self::FORMAT_VERBOSE => ' %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%', |
| 565 | + self::FORMAT_VERBOSE_NOMAX => ' %current% [%bar%] %elapsed:6s%', |
566 | 566 |
|
567 |
| - self::VERY_VERBOSE => ' %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%/%estimated:-6s%', |
568 |
| - self::VERY_VERBOSE_NOMAX => ' %current% [%bar%] %elapsed:6s%', |
| 567 | + self::FORMAT_VERY_VERBOSE => ' %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%/%estimated:-6s%', |
| 568 | + self::FORMAT_VERY_VERBOSE_NOMAX => ' %current% [%bar%] %elapsed:6s%', |
569 | 569 |
|
570 |
| - self::DEBUG => ' %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%/%estimated:-6s% %memory:6s%', |
571 |
| - self::DEBUG_NOMAX => ' %current% [%bar%] %elapsed:6s% %memory:6s%', |
| 570 | + self::FORMAT_DEBUG => ' %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%/%estimated:-6s% %memory:6s%', |
| 571 | + self::FORMAT_DEBUG_NOMAX => ' %current% [%bar%] %elapsed:6s% %memory:6s%', |
572 | 572 | ];
|
573 | 573 | }
|
574 | 574 |
|
|
0 commit comments