/** * Move forward to next leaf. */ public function next() { if ($this->current instanceof RecursiveLeafInterface) { $this->current->next(); if ($this->current->valid()) { if (!isset($this->crown[$this->key()])) { throw new UnexpectedValueException(sprintf('Unexpected element with a unique key "%s".', $this->key())); } return; } } $this->current = next($this->branch); }
/** * Move forward to next leaf. */ public function next() { if (is_null($this->current)) { $this->current = current($this->children); return; } if ($this->current instanceof RecursiveLeafInterface) { $this->current->next(); if ($this->current->valid()) { return; } } $this->current = next($this->children); }
/** * Get next item */ public function next() { if ($this->generator) { $this->generator->next(); } }