CacheWarmer.php 953 B

1234567891011121314151617181920212223242526272829303132
  1. <?php declare(strict_types=1);
  2. /*
  3. * This file is part of phpunit/php-code-coverage.
  4. *
  5. * (c) Sebastian Bergmann <sebastian@phpunit.de>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace SebastianBergmann\CodeCoverage\StaticAnalysis;
  11. use SebastianBergmann\CodeCoverage\Filter;
  12. final class CacheWarmer
  13. {
  14. public function warmCache(string $cacheDirectory, bool $useAnnotationsForIgnoringCode, bool $ignoreDeprecatedCode, Filter $filter): void
  15. {
  16. $analyser = new CachingFileAnalyser(
  17. $cacheDirectory,
  18. new ParsingFileAnalyser(
  19. $useAnnotationsForIgnoringCode,
  20. $ignoreDeprecatedCode,
  21. ),
  22. $useAnnotationsForIgnoringCode,
  23. $ignoreDeprecatedCode,
  24. );
  25. foreach ($filter->files() as $file) {
  26. $analyser->process($file);
  27. }
  28. }
  29. }