/** * Check if current position is valid. * * @return bool */ public function valid() { $valid = $this->_iterator->valid(); if (true === $valid) { return true; } if (null !== $this->_body) { $handle =& $this->_body; $handle($this->_i); } $this->rewind(); if ($this->_n <= $this->_i++) { $this->_i = 1; return false; } return true; }
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); }
/** * Check if current position is valid. * * @return bool */ public function valid() { return $this->_iterator->valid(); }
/** * @see Iterator::valid() * @return bool */ public function valid() { if ($this->iter instanceof Iterator) { return $this->iter->valid(); } elseif (is_array($this->iter)) { return current($this->iter) !== false; // no paths can have this value } return false; // some failure? }
/** * Implentation of the Iterator SPL class for Valid(), * Checks if the current item is a valid item for processing * NULL keys represent an invalid item * * @access public */ public function valid() { return $this->datasource->valid(); }
/** * Returns whether the current iterator offset is valid * * @return Boolean */ function valid() { return isset($this->offset) && $this->inner->valid(); }
public function valid() { return $this->input->valid(); }