芝麻web文件管理V1.00
编辑当前文件:/home/mgatv524/giga.mgaplay.com.br/vendor/mongodb/mongodb/src/Model/CachingIterator.php
iterator = $traversable instanceof Iterator ? $traversable : new IteratorIterator($traversable); $this->iterator->rewind(); $this->storeCurrentItem(); } /** * @see http://php.net/countable.count * @return integer */ #[ReturnTypeWillChange] public function count() { $this->exhaustIterator(); return count($this->items); } /** * @see http://php.net/iterator.current * @return mixed */ #[ReturnTypeWillChange] public function current() { return current($this->items); } /** * @see http://php.net/iterator.key * @return mixed */ #[ReturnTypeWillChange] public function key() { return key($this->items); } /** * @see http://php.net/iterator.next * @return void */ #[ReturnTypeWillChange] public function next() { if (! $this->iteratorExhausted) { $this->iteratorAdvanced = true; $this->iterator->next(); $this->storeCurrentItem(); $this->iteratorExhausted = ! $this->iterator->valid(); } next($this->items); } /** * @see http://php.net/iterator.rewind * @return void */ #[ReturnTypeWillChange] public function rewind() { /* If the iterator has advanced, exhaust it now so that future iteration * can rely on the cache. */ if ($this->iteratorAdvanced) { $this->exhaustIterator(); } reset($this->items); } /** * @see http://php.net/iterator.valid * @return boolean */ #[ReturnTypeWillChange] public function valid() { return $this->key() !== null; } /** * Ensures that the inner iterator is fully consumed and cached. */ private function exhaustIterator() { while (! $this->iteratorExhausted) { $this->next(); } } /** * Stores the current item in the cache. */ private function storeCurrentItem() { if (! $this->iterator->valid()) { return; } $this->items[$this->iterator->key()] = $this->iterator->current(); } }