@@ -856,9 +856,14 @@ public function printProgress(File $file, $numFiles, $numProcessed)
856
856
return ;
857
857
}
858
858
859
+ $ showColors = $ this ->config ->colors ;
860
+ $ colorOpen = '' ;
861
+ $ progressDot = '. ' ;
862
+ $ colorClose = '' ;
863
+
859
864
// Show progress information.
860
865
if ($ file ->ignored === true ) {
861
- echo 'S ' ;
866
+ $ progressDot = 'S ' ;
862
867
} else {
863
868
$ errors = $ file ->getErrorCount ();
864
869
$ warnings = $ file ->getWarningCount ();
@@ -870,27 +875,19 @@ public function printProgress(File $file, $numFiles, $numProcessed)
870
875
// Files with unfixable errors or warnings are E (red).
871
876
// Files with no errors or warnings are . (black).
872
877
if ($ fixable > 0 ) {
873
- if ($ this ->config ->colors === true ) {
874
- echo "\033[31m " ;
875
- }
878
+ $ progressDot = 'E ' ;
876
879
877
- echo 'E ' ;
878
-
879
- if ($ this ->config ->colors === true ) {
880
- echo "\033[0m " ;
880
+ if ($ showColors === true ) {
881
+ $ colorOpen = "\033[31m " ;
882
+ $ colorClose = "\033[0m " ;
881
883
}
882
884
} else if ($ fixed > 0 ) {
883
- if ($ this ->config ->colors === true ) {
884
- echo "\033[32m " ;
885
- }
885
+ $ progressDot = 'F ' ;
886
886
887
- echo 'F ' ;
888
-
889
- if ($ this ->config ->colors === true ) {
890
- echo "\033[0m " ;
887
+ if ($ showColors === true ) {
888
+ $ colorOpen = "\033[32m " ;
889
+ $ colorClose = "\033[0m " ;
891
890
}
892
- } else {
893
- echo '. ' ;
894
891
}//end if
895
892
} else {
896
893
// Files with errors are E (red).
@@ -899,39 +896,35 @@ public function printProgress(File $file, $numFiles, $numProcessed)
899
896
// Files with fixable warnings are W (green).
900
897
// Files with no errors or warnings are . (black).
901
898
if ($ errors > 0 ) {
902
- if ($ this ->config ->colors === true ) {
899
+ $ progressDot = 'E ' ;
900
+
901
+ if ($ showColors === true ) {
903
902
if ($ fixable > 0 ) {
904
- echo "\033[32m " ;
903
+ $ colorOpen = "\033[32m " ;
905
904
} else {
906
- echo "\033[31m " ;
905
+ $ colorOpen = "\033[31m " ;
907
906
}
908
- }
909
-
910
- echo 'E ' ;
911
907
912
- if ($ this ->config ->colors === true ) {
913
- echo "\033[0m " ;
908
+ $ colorClose = "\033[0m " ;
914
909
}
915
910
} else if ($ warnings > 0 ) {
916
- if ($ this ->config ->colors === true ) {
911
+ $ progressDot = 'W ' ;
912
+
913
+ if ($ showColors === true ) {
917
914
if ($ fixable > 0 ) {
918
- echo "\033[32m " ;
915
+ $ colorOpen = "\033[32m " ;
919
916
} else {
920
- echo "\033[33m " ;
917
+ $ colorOpen = "\033[33m " ;
921
918
}
922
- }
923
919
924
- echo 'W ' ;
925
-
926
- if ($ this ->config ->colors === true ) {
927
- echo "\033[0m " ;
920
+ $ colorClose = "\033[0m " ;
928
921
}
929
- } else {
930
- echo '. ' ;
931
922
}//end if
932
923
}//end if
933
924
}//end if
934
925
926
+ echo $ colorOpen .$ progressDot .$ colorClose ;
927
+
935
928
$ numPerLine = 60 ;
936
929
if ($ numProcessed !== $ numFiles && ($ numProcessed % $ numPerLine ) !== 0 ) {
937
930
return ;
0 commit comments