1 | <?php |
||
18 | class ChildlessRecursiveIterator implements RecursiveIterator { |
||
19 | |||
20 | /** |
||
21 | * @var Iterator |
||
22 | */ |
||
23 | protected $iterator; |
||
24 | |||
25 | /** |
||
26 | * @since 1.0 |
||
27 | * |
||
28 | * {@inheritDoc} |
||
29 | */ |
||
30 | 4 | public function __construct( $iterator ) { |
|
31 | |||
32 | 4 | if ( is_array( $iterator ) ) { |
|
33 | 3 | $iterator = new ArrayIterator( $iterator ); |
|
34 | } |
||
35 | |||
36 | 4 | if ( !$iterator instanceof Iterator ) { |
|
37 | 1 | throw new RuntimeException( "ChildlessRecursiveIterator expected an Iterator" ); |
|
38 | } |
||
39 | |||
40 | 3 | $this->iterator = $iterator; |
|
41 | 3 | } |
|
42 | |||
43 | /** |
||
44 | * @since 1.0 |
||
45 | * |
||
46 | * {@inheritDoc} |
||
47 | */ |
||
48 | 2 | public function current() { |
|
51 | |||
52 | /** |
||
53 | * @since 1.0 |
||
54 | * |
||
55 | * {@inheritDoc} |
||
56 | */ |
||
57 | public function key() { |
||
60 | |||
61 | /** |
||
62 | * @since 1.0 |
||
63 | * |
||
64 | * {@inheritDoc} |
||
65 | */ |
||
66 | 2 | public function next() { |
|
69 | |||
70 | /** |
||
71 | * @since 1.0 |
||
72 | * |
||
73 | * {@inheritDoc} |
||
74 | */ |
||
75 | 2 | public function rewind() { |
|
78 | |||
79 | /** |
||
80 | * @since 1.0 |
||
81 | * |
||
82 | * {@inheritDoc} |
||
83 | */ |
||
84 | 2 | public function valid() { |
|
87 | |||
88 | /** |
||
89 | * @since 1.0 |
||
90 | * |
||
91 | * {@inheritDoc} |
||
92 | */ |
||
93 | 1 | public function hasChildren() { |
|
96 | |||
97 | /** |
||
98 | * @since 1.0 |
||
99 | * |
||
100 | * {@inheritDoc} |
||
101 | */ |
||
102 | public function getChildren() { |
||
105 | |||
106 | } |
||
107 |