protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->validateCommand($input);

        $output->writeln('> Loading configuration file');
        $config = $input->getOption('config');
        $files = (new ConfigResolver())->getFileList($config);
        $output->writeLn('- Found '.count($files).' files');

        $preloader = (new Factory())->create($this->getOptions($input));

        $outputFile = $input->getOption('output');
        $handle = $preloader->prepareOutput($outputFile, $input->getOption('strict_types'));

        $output->writeln('> Compiling classes');

        $count = 0;
        $countSkipped = 0;
        $comments = !$input->getOption('strip_comments');

        foreach ($files as $file) {
            $count++;

            try {
                $code = $preloader->getCode($file, $comments);
                $output->writeln('- Writing '.$file);
                fwrite($handle, $code."\n");
            } catch (VisitorExceptionInterface $e) {
                $countSkipped++;
                $output->writeln('- Skipping '.$file);
            }
        }

        fclose($handle);

        $output->writeln("> Compiled loader written to $outputFile");
        $output->writeln('- Files: '.($count - $countSkipped).'/'.$count.' (skipped: '.$countSkipped.')');
        $output->writeln('- Filesize: '.(round(filesize($outputFile) / 1024)).' kb');
    }
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->validateCommand($input);

        $output->writeln('> Loading configuration file');
        $config = $input->getOption('config');
        $files = (new ConfigResolver())->getFileList($config);
        $output->writeLn('- Found '.count($files).' files');

        $preloader = (new Factory())->create($this->getOptions($input));

        $outputFile = $input->getOption('output');
        $handle = $preloader->prepareOutput($outputFile, $input->getOption('strict_types'));

        $output->writeln('> Compiling classes');

        $count = 0;
        $countSkipped = 0;
        $comments = !$input->getOption('strip_comments');

        foreach ($files as $file) {
            $count++;

            try {
                $code = $preloader->getCode($file, $comments);
                $output->writeln('- Writing '.$file);
                fwrite($handle, $code."\n");
            } catch (VisitorExceptionInterface $e) {
                $countSkipped++;
                $output->writeln('- Skipping '.$file);
            }
        }

        fclose($handle);

        $output->writeln("> Compiled loader written to $outputFile");
        $output->writeln('- Files: '.($count - $countSkipped).'/'.$count.' (skipped: '.$countSkipped.')');
        $output->writeln('- Filesize: '.(round(filesize($outputFile) / 1024)).' kb');
    }
protected function execute ( InputInterface $ input , OutputInterface $ output ) { $ this -> validateCommand ( $ input ) ; $ output -> writeln ( '> Loading configuration file' ) ; $ config = $ input -> getOption ( 'config' ) ; $ files = ( new ConfigResolver ( ) ) -> getFileList ( $ config ) ; $ output -> writeLn ( '- Found ' . count ( $ files ) . ' files' ) ; $ preloader = ( new Factory ( ) ) -> create ( $ this -> getOptions ( $ input ) ) ; $ outputFile = $ input -> getOption ( 'output' ) ; $ handle = $ preloader -> prepareOutput ( $ outputFile , $ input -> getOption ( 'strict_types' ) ) ; $ output -> writeln ( '> Compiling classes' ) ; $ count = 0 ; $ countSkipped = 0 ; $ comments = ! $ input -> getOption ( 'strip_comments' ) ; foreach ( $ files as $ file ) { $ count ++ ; try { $ code = $ preloader -> getCode ( $ file , $ comments ) ; $ output -> writeln ( '- Writing ' . $ file ) ; fwrite ( $ handle , $ code . "\n" ) ; } catch ( VisitorExceptionInterface $ e ) { $ countSkipped ++ ; $ output -> writeln ( '- Skipping ' . $ file ) ; } } fclose ( $ handle ) ; $ output -> writeln ( "> Compiled loader written to $outputFile" ) ; $ output -> writeln ( '- Files: ' . ( $ count - $ countSkipped ) . '/' . $ count . ' (skipped: ' . $ countSkipped . ')' ) ; $ output -> writeln ( '- Filesize: ' . ( round ( filesize ( $ outputFile ) / 1024 ) ) . ' kb' ) ; }
Executes the pre-compile command.

@param \Symfony\Component\Console\Input\InputInterface   $input
@param \Symfony\Component\Console\Output\OutputInterface $output

@return int|null
Executes the pre - compile command .