public function accept() { $rel = $this->getInnerIterator()->current(); // path relative to given directory $path = $this->params['dir'] . "/{$rel}"; // full storage path if ($this->backend->isSingleShardPathInternal($path)) { return true; // path is only on one shard; no issue with duplicates } elseif (isset($this->multiShardPaths[$rel])) { // Don't keep listing paths that are on multiple shards return false; } else { $this->multiShardPaths[$rel] = 1; return true; } }
/** * Filter out duplicate items by advancing to the next ones */ protected function filterViaNext() { while ($this->valid()) { $rel = $this->iter->current(); // path relative to given directory $path = $this->params['dir'] . "/{$rel}"; // full storage path if ($this->backend->isSingleShardPathInternal($path)) { break; // path is only on one shard; no issue with duplicates } elseif (isset($this->multiShardPaths[$rel])) { // Don't keep listing paths that are on multiple shards $this->iter instanceof Iterator ? $this->iter->next() : next($this->iter); } else { $this->multiShardPaths[$rel] = 1; break; } } }