/** * Returns the iterator for the next sequence, or NULL if the end of * the outer iterator has been reached. * * @return php.Iterator */ protected function sequence() { while ($this->it->valid()) { $value = $this->it->current(); $seq = $value instanceof Sequence ? $value->getIterator() : Sequence::of($value)->getIterator(); $seq->rewind(); if ($seq->valid()) { return $seq; } else { $this->it->next(); } } return null; }