diff --git a/src/PHPSemVerChecker/Console/Command/CompareCommand.php b/src/PHPSemVerChecker/Console/Command/CompareCommand.php index b67e779..dc36016 100644 --- a/src/PHPSemVerChecker/Console/Command/CompareCommand.php +++ b/src/PHPSemVerChecker/Console/Command/CompareCommand.php @@ -4,6 +4,7 @@ use File_Iterator_Facade; use PHPSemVerChecker\Analyzer\Analyzer; +use PHPSemVerChecker\Filter\SourceFilter; use PHPSemVerChecker\Reporter\Reporter; use PHPSemVerChecker\Scanner\Scanner; use Symfony\Component\Console\Command\Command; @@ -43,6 +44,14 @@ protected function execute(InputInterface $input, OutputInterface $output) $progress = new ProgressBar($output, count($sourceBefore) + count($sourceAfter)); $progress->setFormat("%message%\n%current%/%max% [%bar%] %percent:3s%% %elapsed:6s%/%estimated:-6s% %memory:6s%"); + $progress->setMessage('Pre-processing before/after files'); + $progress->start(); + + $sourceFilter = new SourceFilter(); + $identicalCount = $sourceFilter->filter($sourceBefore, $sourceAfter); + + $progress->start(count($sourceBefore) + count($sourceAfter)); + $progress->setMessage('Scanning before files'); foreach ($sourceBefore as $file) { $scannerBefore->scan($file); @@ -68,6 +77,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $duration = microtime(true) - $startTime; $output->writeln(''); + $output->writeln('[Scanned files] Before: ' . count($sourceBefore) . ', After: ' . count($sourceAfter) . ', Identical: ' . $identicalCount); $output->writeln('Time: ' . round($duration, 3) . ' seconds, Memory: ' . round(memory_get_peak_usage() / 1024 / 1024, 3) . ' MB'); } } diff --git a/src/PHPSemVerChecker/Filter/SourceFilter.php b/src/PHPSemVerChecker/Filter/SourceFilter.php new file mode 100644 index 0000000..640e2eb --- /dev/null +++ b/src/PHPSemVerChecker/Filter/SourceFilter.php @@ -0,0 +1,28 @@ +