@@ -41,6 +41,8 @@ class DefaultTheme implements ThemeInterface
4141
4242 protected int $ executionTimeVerbosity = OutputInterface::VERBOSITY_VERBOSE ;
4343
44+ protected int $ statusLabelVerbosity = OutputInterface::VERBOSITY_VERBOSE ;
45+
4446 public function __construct ()
4547 {
4648 $ this
@@ -51,9 +53,9 @@ public function __construct()
5153 ->setStateErrorColor (new Color ('white ' , 'red ' ));
5254 }
5355
54- public function setStateReadyColor (Color $ stateReadyColor ): static
56+ public function setStateReadyColor (Color $ color ): static
5557 {
56- $ this ->stateReadyColor = $ stateReadyColor ;
58+ $ this ->stateReadyColor = $ color ;
5759
5860 return $ this ;
5961 }
@@ -63,9 +65,9 @@ public function getStateReadyColor(): Color
6365 return $ this ->stateReadyColor ;
6466 }
6567
66- public function setStateReadyIcon (string $ stateReadyIcon ): static
68+ public function setStateReadyIcon (string $ icon ): static
6769 {
68- $ this ->stateReadyIcon = $ stateReadyIcon ;
70+ $ this ->stateReadyIcon = $ icon ;
6971
7072 return $ this ;
7173 }
@@ -75,9 +77,9 @@ public function getStateReadyIcon(): string
7577 return $ this ->stateReadyIcon ;
7678 }
7779
78- public function setStateCanceledColor (Color $ stateCanceledColor ): static
80+ public function setStateCanceledColor (Color $ color ): static
7981 {
80- $ this ->stateCanceledColor = $ stateCanceledColor ;
82+ $ this ->stateCanceledColor = $ color ;
8183
8284 return $ this ;
8385 }
@@ -87,9 +89,9 @@ public function getStateCanceledColor(): Color
8789 return $ this ->stateCanceledColor ;
8890 }
8991
90- public function setStateCanceledIcon (string $ stateCanceledIcon ): static
92+ public function setStateCanceledIcon (string $ icon ): static
9193 {
92- $ this ->stateCanceledIcon = $ stateCanceledIcon ;
94+ $ this ->stateCanceledIcon = $ icon ;
9395
9496 return $ this ;
9597 }
@@ -99,9 +101,9 @@ public function getStateCanceledIcon(): string
99101 return $ this ->stateCanceledIcon ;
100102 }
101103
102- public function setStateRunningColor (Color $ stateRunningColor ): static
104+ public function setStateRunningColor (Color $ color ): static
103105 {
104- $ this ->stateRunningColor = $ stateRunningColor ;
106+ $ this ->stateRunningColor = $ color ;
105107
106108 return $ this ;
107109 }
@@ -111,9 +113,9 @@ public function getStateRunningColor(): Color
111113 return $ this ->stateRunningColor ;
112114 }
113115
114- public function setStateRunningIcon (string $ stateRunningIcon ): static
116+ public function setStateRunningIcon (string $ icon ): static
115117 {
116- $ this ->stateRunningIcon = $ stateRunningIcon ;
118+ $ this ->stateRunningIcon = $ icon ;
117119
118120 return $ this ;
119121 }
@@ -123,9 +125,9 @@ public function getStateRunningIcon(): string
123125 return $ this ->stateRunningIcon ;
124126 }
125127
126- public function setStateSuccessfulColor (Color $ stateSuccessfulColor ): static
128+ public function setStateSuccessfulColor (Color $ color ): static
127129 {
128- $ this ->stateSuccessfulColor = $ stateSuccessfulColor ;
130+ $ this ->stateSuccessfulColor = $ color ;
129131
130132 return $ this ;
131133 }
@@ -135,9 +137,9 @@ public function getStateSuccessfulColor(): Color
135137 return $ this ->stateSuccessfulColor ;
136138 }
137139
138- public function setStateSuccessfulIcon (string $ stateSuccessfulIcon ): static
140+ public function setStateSuccessfulIcon (string $ icon ): static
139141 {
140- $ this ->stateSuccessfulIcon = $ stateSuccessfulIcon ;
142+ $ this ->stateSuccessfulIcon = $ icon ;
141143
142144 return $ this ;
143145 }
@@ -147,9 +149,9 @@ public function getStateSuccessfulIcon(): string
147149 return $ this ->stateSuccessfulIcon ;
148150 }
149151
150- public function setStateErrorColor (Color $ stateErrorColor ): static
152+ public function setStateErrorColor (Color $ color ): static
151153 {
152- $ this ->stateErrorColor = $ stateErrorColor ;
154+ $ this ->stateErrorColor = $ color ;
153155
154156 return $ this ;
155157 }
@@ -159,9 +161,9 @@ public function getStateErrorColor(): Color
159161 return $ this ->stateErrorColor ;
160162 }
161163
162- public function setStateErrorIcon (string $ stateErrorIcon ): static
164+ public function setStateErrorIcon (string $ icon ): static
163165 {
164- $ this ->stateErrorIcon = $ stateErrorIcon ;
166+ $ this ->stateErrorIcon = $ icon ;
165167
166168 return $ this ;
167169 }
@@ -171,9 +173,9 @@ public function getStateErrorIcon(): string
171173 return $ this ->stateErrorIcon ;
172174 }
173175
174- public function setExecutionTimeVerbosity (int $ executionTimeVerbosity ): static
176+ public function setExecutionTimeVerbosity (int $ verbosity ): static
175177 {
176- $ this ->executionTimeVerbosity = $ executionTimeVerbosity ;
178+ $ this ->executionTimeVerbosity = $ verbosity ;
177179
178180 return $ this ;
179181 }
@@ -183,6 +185,18 @@ public function getExecutionTimeVerbosity(): int
183185 return $ this ->executionTimeVerbosity ;
184186 }
185187
188+ public function setStatusLabelVerbosity (int $ verbosity ): static
189+ {
190+ $ this ->statusLabelVerbosity = $ verbosity ;
191+
192+ return $ this ;
193+ }
194+
195+ public function getStatusLabelVerbosity (): int
196+ {
197+ return $ this ->statusLabelVerbosity ;
198+ }
199+
186200 public function resetOutput (OutputInterface $ output , ProcessInterfaceCollection $ processes ): static
187201 {
188202 for ($ reset = 0 ; $ reset < $ processes ->count (); $ reset ++) {
@@ -241,15 +255,15 @@ protected function outputProcessSummary(OutputInterface $output, ProcessInterfac
241255 $ this ->mergeProcessOutput (
242256 $ output ,
243257 $ process ->getOutputSummaryPrefix (),
244- $ process ->getErrorOutput (),
258+ $ process ->getOutput (),
245259 $ lines
246260 );
247261 }
248262 if ($ process ->getErrorOutputVerbosity () <= $ output ->getVerbosity ()) {
249263 $ this ->mergeProcessOutput (
250264 $ output ,
251265 $ process ->getOutputSummaryPrefix (),
252- $ process ->getOutput (),
266+ $ process ->getErrorOutput (),
253267 $ lines
254268 );
255269 }
@@ -337,8 +351,13 @@ protected function outputProcessState(
337351 }
338352
339353 $ title = $ process ->getName ();
354+
355+ if ($ output ->getVerbosity () >= $ this ->getStatusLabelVerbosity ()) {
356+ $ title .= ' - ' . $ this ->getStatusLabel ($ process );
357+ }
358+
340359 if ($ output ->getVerbosity () >= $ this ->getExecutionTimeVerbosity () && $ process ->isStarted ()) {
341- $ title .= ' ( ' . $ process ->getExecutionTime () . ' ms) ' ;
360+ $ title .= ' - ' . $ this -> getExecutionTimeLabel ( $ process ->getExecutionTime ()) ;
342361 }
343362
344363 if ($ isSummary && $ this ->processWillHaveOutput ($ output , $ process ) && $ output ->isDecorated ()) {
@@ -415,6 +434,38 @@ protected function getProcessStateIcon(ProcessInterface $process): string
415434 return $ return ;
416435 }
417436
437+ protected function getStatusLabel (ProcessInterface $ process ): string
438+ {
439+ if ($ process ->isCanceled ()) {
440+ $ return = 'Canceled ' ;
441+ } elseif ($ process ->getStatus () === Process::STATUS_READY ) {
442+ $ return = 'Waiting ' ;
443+ } elseif ($ process ->isRunning ()) {
444+ $ return = 'Running ' ;
445+ } elseif ($ process ->isTerminated () && $ process ->isSuccessful ()) {
446+ $ return = 'Success ' ;
447+ } elseif ($ process ->isTerminated () && $ process ->isSuccessful () === false ) {
448+ $ return = 'Error ' ;
449+ } else {
450+ throw new \Exception ('Unknown process state. ' );
451+ }
452+
453+ return $ return ;
454+ }
455+
456+ protected function getExecutionTimeLabel (int $ executionTime ): string
457+ {
458+ if ($ executionTime >= 60000 ) {
459+ $ return = number_format ($ executionTime / 60000 , 2 ) . ' min ' ;
460+ } elseif ($ executionTime >= 1000 ) {
461+ $ return = number_format ($ executionTime / 1000 , 1 ) . ' sec ' ;
462+ } else {
463+ $ return = $ executionTime . ' ms ' ;
464+ }
465+
466+ return $ return ;
467+ }
468+
418469 protected function writeBufferedLines (OutputInterface $ output ): static
419470 {
420471 if ($ output instanceof ConsoleBufferedOutput) {
0 commit comments