/** * @param Package $package * * @return RuleSet */ private function loadPackageRuleSet(Package $package) { $ruleSet = new RuleSet(); $key = $package->generatePackageKey(); if ($this->cache->has($key)) { $ruleSet = $this->cache->getCachedRuleSet($key); } elseif (is_dir($path = $package->getPackagePath(self::PACKAGE_PATH))) { $this->traverser->reset(); $ruleSet = $this->traverser->traverse($path); $this->cache->cacheRuleSet($key, $ruleSet); } else { // there is no vendor package in the given path } return $ruleSet; }