function current() { $current = $this->_iterator->current(); return $this->_pipe->process($current); }
/** * Implentation of the Iterator SPL class for Rewind(), * prepares the whole datasource for an entirely new iterator operation * * @access public */ public function rewind() { $this->datasource->rewind(); //Process the transformers if ($this->valid()) { $this->transformedData = $this->transform($this->datasource->current(), $this->datasource->key()); } }
/** * Return the current element. * * @return mixed */ public function current() { if (null !== $this->_current) { return $this->_current; } $demuxer = $this->_demuxer; return $this->_current = $demuxer($this->_iterator->current()); }
public static function findMinMax(\Traversable $it, callback $extractor = null) { if ($extractor === null) { $extractor = function ($value) { return $value; }; } $min = $max = $extractor($it->current()); $it->next(); $value = $extractor($it->current()); while ($it->valid()) { if ($value > $max) { $max = $value; } elseif ($value < $min) { $min = $value; } $it->next(); $value = $it->current(); } return array($min, $max); }
/** * Return the current element. * * @return mixed */ public function current() { return $this->_iterator->current(); }
/** * 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; } } }
/** * Returns the current value from the iterator * * @return Mixed */ function current() { return isset($this->offset) ? $this->inner->current() : NULL; }
/** * Implentation of the Iterator SPL class for Current(), * returns the current element of the data source * Returns null if nothing found * * @access public * * @return mixed Current value of the iterator */ public function current() { return $this->datasource->current(); }
public function current() { return $this->input->current(); }
/** * Example of applying a callback to capitalize the first letter. * * Note that you must return TRUE from the callback function to continue * iterating. This can be useful if you wish to stop iteration under * certain conditions. * * @param Iterator $it * @return bool */ function addDbPrefix(Traversable $it, $prefix = 'test') { echo $it[$it->key()] = $prefix . '_' . $it->current(); echo PHP_EOL; return true; }