@@ -848,9 +848,14 @@ public function printProgress(File $file, $numFiles, $numProcessed)
848848 return ;
849849 }
850850
851+ $ showColors = $ this ->config ->colors ;
852+ $ colorOpen = '' ;
853+ $ progressDot = '. ' ;
854+ $ colorClose = '' ;
855+
851856 // Show progress information.
852857 if ($ file ->ignored === true ) {
853- Common:: printStatusMessage ( 'S ' , 0 , true ) ;
858+ $ progressDot = 'S ' ;
854859 } else {
855860 $ errors = $ file ->getErrorCount ();
856861 $ warnings = $ file ->getWarningCount ();
@@ -862,27 +867,19 @@ public function printProgress(File $file, $numFiles, $numProcessed)
862867 // Files with unfixable errors or warnings are E (red).
863868 // Files with no errors or warnings are . (black).
864869 if ($ fixable > 0 ) {
865- if ($ this ->config ->colors === true ) {
866- Common::printStatusMessage ("\033[31m " , 0 , true );
867- }
870+ $ progressDot = 'E ' ;
868871
869- Common::printStatusMessage ('E ' , 0 , true );
870-
871- if ($ this ->config ->colors === true ) {
872- Common::printStatusMessage ("\033[0m " , 0 , true );
872+ if ($ showColors === true ) {
873+ $ colorOpen = "\033[31m " ;
874+ $ colorClose = "\033[0m " ;
873875 }
874876 } else if ($ fixed > 0 ) {
875- if ($ this ->config ->colors === true ) {
876- Common::printStatusMessage ("\033[32m " , 0 , true );
877- }
877+ $ progressDot = 'F ' ;
878878
879- Common::printStatusMessage ('F ' , 0 , true );
880-
881- if ($ this ->config ->colors === true ) {
882- Common::printStatusMessage ("\033[0m " , 0 , true );
879+ if ($ showColors === true ) {
880+ $ colorOpen = "\033[32m " ;
881+ $ colorClose = "\033[0m " ;
883882 }
884- } else {
885- Common::printStatusMessage ('. ' , 0 , true );
886883 }//end if
887884 } else {
888885 // Files with errors are E (red).
@@ -891,39 +888,35 @@ public function printProgress(File $file, $numFiles, $numProcessed)
891888 // Files with fixable warnings are W (green).
892889 // Files with no errors or warnings are . (black).
893890 if ($ errors > 0 ) {
894- if ($ this ->config ->colors === true ) {
891+ $ progressDot = 'E ' ;
892+
893+ if ($ showColors === true ) {
895894 if ($ fixable > 0 ) {
896- Common:: printStatusMessage ( "\033[32m " , 0 , true ) ;
895+ $ colorOpen = "\033[32m " ;
897896 } else {
898- Common:: printStatusMessage ( "\033[31m " , 0 , true ) ;
897+ $ colorOpen = "\033[31m " ;
899898 }
900- }
901-
902- Common::printStatusMessage ('E ' , 0 , true );
903899
904- if ($ this ->config ->colors === true ) {
905- Common::printStatusMessage ("\033[0m " , 0 , true );
900+ $ colorClose = "\033[0m " ;
906901 }
907902 } else if ($ warnings > 0 ) {
908- if ($ this ->config ->colors === true ) {
903+ $ progressDot = 'W ' ;
904+
905+ if ($ showColors === true ) {
909906 if ($ fixable > 0 ) {
910- Common:: printStatusMessage ( "\033[32m " , 0 , true ) ;
907+ $ colorOpen = "\033[32m " ;
911908 } else {
912- Common:: printStatusMessage ( "\033[33m " , 0 , true ) ;
909+ $ colorOpen = "\033[33m " ;
913910 }
914- }
915911
916- Common::printStatusMessage ('W ' , 0 , true );
917-
918- if ($ this ->config ->colors === true ) {
919- Common::printStatusMessage ("\033[0m " , 0 , true );
912+ $ colorClose = "\033[0m " ;
920913 }
921- } else {
922- Common::printStatusMessage ('. ' , 0 , true );
923914 }//end if
924915 }//end if
925916 }//end if
926917
918+ Common::printStatusMessage ($ colorOpen .$ progressDot .$ colorClose , 0 , true );
919+
927920 $ numPerLine = 60 ;
928921 if ($ numProcessed !== $ numFiles && ($ numProcessed % $ numPerLine ) !== 0 ) {
929922 return ;
0 commit comments