@@ -64,8 +64,9 @@ protected function configure()
6464 */
6565 protected function execute (InputInterface $ input , OutputInterface $ output ): int
6666 {
67- $ xml = ($ input ->getOption ('xml ' )) ? '--xml ' : "" ;
68- $ noAnsi = ($ input ->getOption ('no-ansi ' )) ? '--no-ansi ' : "" ;
67+ $ xml = ($ input ->getOption ('xml ' ))
68+ ? '--xml '
69+ : "" ;
6970 $ skipGeneration = $ input ->getOption ('skip-generate ' );
7071 $ force = $ input ->getOption ('force ' );
7172 $ groups = $ input ->getArgument ('groups ' );
@@ -135,8 +136,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
135136 $ process ->setIdleTimeout (600 );
136137 $ process ->setTimeout (0 );
137138 $ returnCodes [] = $ process ->run (
138- function ($ type , $ buffer ) use ($ output , $ noAnsi ) {
139- $ buffer = $ this ->disableAnsiColorCodes ($ buffer , $ noAnsi );
139+ function ($ type , $ buffer ) use ($ output ) {
140140 $ output ->write ($ buffer );
141141 }
142142 );
@@ -159,19 +159,4 @@ function ($type, $buffer) use ($output, $noAnsi) {
159159 }
160160 return max ($ exitCode , $ generationErrorCode );
161161 }
162-
163- /**
164- * @param string $buffer
165- * @param string $noAnsi
166- * @return string
167- */
168- private function disableAnsiColorCodes ($ buffer , $ noAnsi ) :string
169- {
170- if (empty ($ noAnsi )) {
171- return $ buffer ;
172- }
173- $ pattern = "/ \x1B\[([0-9]{1,2}(;[0-9]{1,2})*)?[m|K]/ " ;
174- // Use preg_replace to remove ANSI escape codes from the string
175- return preg_replace ($ pattern , '' , $ buffer );
176- }
177162}
0 commit comments