/**
* Warms up the cache.
*
* @param string $cacheDir The cache directory
*/
public function warmUp($cacheDir)
{
$options = $this->aspectKernel->getOptions();
$oldCacheDir = $this->cachePathManager->getCacheDir();
$this->cachePathManager->setCacheDir($cacheDir . '/aspect');
$enumerator = new Enumerator($options['appDir'], $options['includePaths'], $options['excludePaths']);
$iterator = $enumerator->enumerate();
set_error_handler(function ($errno, $errstr, $errfile, $errline) {
throw new \ErrorException($errstr, $errno, 0, $errfile, $errline);
});
$errors = array();
foreach ($iterator as $file) {
$realPath = $file->getRealPath();
try {
// This will trigger creation of cache
file_get_contents(FilterInjectorTransformer::PHP_FILTER_READ . SourceTransformingLoader::FILTER_IDENTIFIER . "/resource=" . $realPath);
} catch (\Exception $e) {
$errors[$realPath] = $e;
}
}
restore_error_handler();
$this->cachePathManager->flushCacheState();
$this->cachePathManager->setCacheDir($oldCacheDir);
}