parameterProvider = $parameterProvider; $this->smartFileSystem = $smartFileSystem; } public function create() : \Rector\Caching\Cache { $cacheDirectory = $this->parameterProvider->provideStringParameter(\Rector\Core\Configuration\Option::CACHE_DIR); $cacheClass = \Rector\Caching\ValueObject\Storage\FileCacheStorage::class; if ($this->parameterProvider->hasParameter(\Rector\Core\Configuration\Option::CACHE_CLASS)) { $cacheClass = $this->parameterProvider->provideStringParameter(\Rector\Core\Configuration\Option::CACHE_CLASS); } if ($cacheClass === \Rector\Caching\ValueObject\Storage\FileCacheStorage::class) { // ensure cache directory exists if (!$this->smartFileSystem->exists($cacheDirectory)) { $this->smartFileSystem->mkdir($cacheDirectory); } $fileCacheStorage = new \Rector\Caching\ValueObject\Storage\FileCacheStorage($cacheDirectory, $this->smartFileSystem); return new \Rector\Caching\Cache($fileCacheStorage); } return new \Rector\Caching\Cache(new \Rector\Caching\ValueObject\Storage\MemoryCacheStorage()); } }