예제 #1
0
 public function searchDir(string $dir, bool $recursive = false) : LocatorInterface
 {
     foreach ($this->getIterator($dir, $recursive) as $entity) {
         $entity = \sndsgd\Fs::createFromSplFileInfo($entity);
         $path = $entity->getPath();
         if (isset($this->results[$path]) || $this->filter && !call_user_func($this->filter, $entity)) {
             continue;
         }
         $this->results[$path] = $entity;
     }
     return $this;
 }