traverse() public method

public traverse ( string $path, SensioLabs\DeprecationDetector\RuleSet\RuleSet $ruleSet = null ) : SensioLabs\DeprecationDetector\RuleSet\RuleSet
$path string
$ruleSet SensioLabs\DeprecationDetector\RuleSet\RuleSet
return SensioLabs\DeprecationDetector\RuleSet\RuleSet
 /**
  * {@inheritdoc}
  */
 public function loadRuleSet($path)
 {
     $key = $this->generateDirectoryKey($path);
     if ($this->cache->has($key)) {
         return $this->cache->getCachedRuleSet($key);
     }
     $ruleSet = $this->traverser->traverse($path);
     $this->cache->cacheRuleSet($key, $ruleSet);
     return $ruleSet;
 }
 /**
  * @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))) {
         $ruleSet = $this->traverser->traverse($path);
         $this->cache->cacheRuleSet($key, $ruleSet);
     } else {
         // there is no vendor package in the given path
     }
     return $ruleSet;
 }
 /**
  * @param $package
  *
  * @return RuleSet
  */
 private function loadPackageRuleSet(\stdClass $package)
 {
     $ruleSet = null;
     $key = $this->generatePackageKey($package);
     if ($this->cache->has($key)) {
         $ruleSet = $this->cache->getCachedRuleSet($key);
     } elseif (is_dir($path = $this->getPackagePath($package))) {
         $ruleSet = $this->traverser->traverse($path);
         $this->cache->cacheRuleSet($key, $ruleSet);
     }
     return $ruleSet;
 }
 public function testTraverse()
 {
     $aPhpFileInfo = $this->prophesize('SensioLabs\\DeprecationDetector\\FileInfo\\PhpFileInfo');
     $aPhpFileInfo->hasDeprecations()->willReturn(true);
     $aPhpFileInfo->classDeprecations()->willReturn(array());
     $aPhpFileInfo->methodDeprecations()->willReturn(array());
     $aPhpFileInfo->interfaceDeprecations()->willReturn(array());
     $anotherPhpFileInfo = $this->prophesize('SensioLabs\\DeprecationDetector\\FileInfo\\PhpFileInfo');
     $anotherPhpFileInfo->hasDeprecations()->willReturn(false);
     $deprecationFileFinder = $this->prophesize('SensioLabs\\DeprecationDetector\\Finder\\ParsedPhpFileFinder');
     $deprecationFileFinder->in('some_dir')->willReturn(array($aPhpFileInfo->reveal(), $anotherPhpFileInfo->reveal()));
     $ruleSet = $this->prophesize('SensioLabs\\DeprecationDetector\\RuleSet\\RuleSet');
     $ruleSet->merge($aPhpFileInfo->reveal())->shouldBeCalled();
     $ruleSet->merge($anotherPhpFileInfo->reveal())->shouldNotBeCalled();
     $directoryTraverser = new DirectoryTraverser($deprecationFileFinder->reveal());
     $directoryTraverser->traverse('some_dir', $ruleSet->reveal());
 }