Ejemplo n.º 1
0
 /**
  * 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;
 }
Ejemplo n.º 2
0
 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);
 }
Ejemplo n.º 3
0
 /**
  * Check if current position is valid.
  *
  * @return  bool
  */
 public function valid()
 {
     return $this->_iterator->valid();
 }
Ejemplo n.º 4
0
 /**
  * @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();
 }
Ejemplo n.º 6
0
 /**
  * Returns whether the current iterator offset is valid
  *
  * @return Boolean
  */
 function valid()
 {
     return isset($this->offset) && $this->inner->valid();
 }
Ejemplo n.º 7
0
 public function valid()
 {
     return $this->input->valid();
 }