10
10
use Symfony \Component \Console \Terminal ;
11
11
use function array_map ;
12
12
use function strlen ;
13
- use function time ;
14
13
use function wordwrap ;
14
+ use const DIRECTORY_SEPARATOR ;
15
15
16
16
class ErrorsConsoleStyle extends SymfonyStyle
17
17
{
@@ -77,7 +77,21 @@ public function table(array $headers, array $rows): void
77
77
public function createProgressBar (int $ max = 0 ): ProgressBar
78
78
{
79
79
$ this ->progressBar = parent ::createProgressBar ($ max );
80
- $ this ->progressBar ->setOverwrite (!$ this ->isCiDetected ());
80
+
81
+ $ ci = $ this ->isCiDetected ();
82
+ $ this ->progressBar ->setOverwrite (!$ ci );
83
+
84
+ if ($ ci ) {
85
+ $ this ->progressBar ->minSecondsBetweenRedraws (15 );
86
+ $ this ->progressBar ->maxSecondsBetweenRedraws (30 );
87
+ } elseif (DIRECTORY_SEPARATOR === '\\' ) {
88
+ $ this ->progressBar ->minSecondsBetweenRedraws (0.5 );
89
+ $ this ->progressBar ->maxSecondsBetweenRedraws (2 );
90
+ } else {
91
+ $ this ->progressBar ->minSecondsBetweenRedraws (0.1 );
92
+ $ this ->progressBar ->maxSecondsBetweenRedraws (0.5 );
93
+ }
94
+
81
95
return $ this ->progressBar ;
82
96
}
83
97
@@ -95,15 +109,6 @@ public function progressAdvance(int $step = 1): void
95
109
return ;
96
110
}
97
111
98
- if (!$ this ->isCiDetected () && $ step > 0 ) {
99
- $ stepTime = (time () - $ this ->progressBar ->getStartTime ()) / $ step ;
100
- if ($ stepTime > 0 && $ stepTime < 1 ) {
101
- $ this ->progressBar ->setRedrawFrequency ((int ) (1 / $ stepTime ));
102
- } else {
103
- $ this ->progressBar ->setRedrawFrequency (1 );
104
- }
105
- }
106
-
107
112
parent ::progressAdvance ($ step );
108
113
}
109
114
0 commit comments