Esempio n. 1
0
 /**
  * Checks if current position is valid.
  *
  * @return bool Returns true on success, false otherwise
  */
 public function valid()
 {
     if (is_null($this->current)) {
         return !empty($this->branch);
     }
     if ($this->current instanceof RecursiveLeafInterface) {
         return $this->current->valid();
     }
     return false;
 }
Esempio n. 2
0
 /**
  * For a callable, it's always valid to iterate
  *
  * @return bool
  */
 public function valid()
 {
     return $this->generator ? $this->generator->valid() : true;
 }