/** * @param ConfigInterface $config * @param bool $isDryRun * * @return CacheManagerInterface */ private function createCacheManager(ConfigInterface $config, $isDryRun) { if ($config->usingCache() && (ToolInfo::isInstalledAsPhar() || ToolInfo::isInstalledByComposer())) { return new FileCacheManager(new FileHandler($config->getCacheFile()), new Signature(PHP_VERSION, ToolInfo::getVersion(), $config->usingLinter(), $config->getRules()), $isDryRun); } return new NullCacheManager(); }
private function isCacheAvailable() { static $result; if (null === $result) { $result = $this->isEnabled && (ToolInfo::isInstalledAsPhar() || ToolInfo::isInstalledByComposer()); } return $result; }
/** * @return CacheManagerInterface */ public function getCacheManager() { if (null === $this->cacheManager) { if ($this->getUsingCache() && (ToolInfo::isInstalledAsPhar() || ToolInfo::isInstalledByComposer())) { $this->cacheManager = new FileCacheManager(new FileHandler($this->getCacheFile()), new Signature(PHP_VERSION, ToolInfo::getVersion(), $this->getRules()), $this->isDryRun()); } else { $this->cacheManager = new NullCacheManager(); } } return $this->cacheManager; }