# The ParentIterator class

(PHP 5 >= 5.1.0, PHP 7, PHP 8)

## Introduction

This extended FilterIterator allows a recursive iteration using RecursiveIteratorIterator that only shows those elements which have children.

## Class synopsis

class ParentIterator extends RecursiveFilterIterator {
/* Methods */
public __construct(RecursiveIterator `$iterator`)
public accept(): bool
public getChildren(): ParentIterator
public hasChildren(): bool
public next(): void
public rewind(): void
/* Inherited methods */
public RecursiveFilterIterator::getChildren(): ?RecursiveFilterIterator
public RecursiveFilterIterator::hasChildren(): bool
public FilterIterator::accept(): bool
public FilterIterator::current(): mixed
public FilterIterator::key(): mixed
public FilterIterator::next(): void
public FilterIterator::rewind(): void
public FilterIterator::valid(): bool
public IteratorIterator::current(): mixed
public IteratorIterator::getInnerIterator(): ?Iterator
public IteratorIterator::key(): mixed
public IteratorIterator::next(): void
public IteratorIterator::rewind(): void
public IteratorIterator::valid(): bool
}

## Table of Contents

- ParentIterator::accept — Determines acceptability
- ParentIterator::__construct — Constructs a ParentIterator
- ParentIterator::getChildren — Return the inner iterator's children contained in a ParentIterator
- ParentIterator::hasChildren — Check whether the inner iterator's current element has children
- ParentIterator::next — Move the iterator forward
- ParentIterator::rewind — Rewind the iterator

`↑` and `↓` to navigate • `Enter` to select • `Esc` to close • `/` to open