1 | <?php |
||
16 | class TraversableIterator implements Iterator { |
||
17 | |||
18 | private $traversable; |
||
19 | |||
20 | /** |
||
21 | * @var Iterator |
||
22 | */ |
||
23 | private $innerIterator; |
||
24 | |||
25 | 9 | public function __construct( Traversable $traversable ) { |
|
29 | |||
30 | 9 | private function buildInnerIterator(): Iterator { |
|
41 | |||
42 | /** |
||
43 | * Return the current element |
||
44 | * @see Iterator::current |
||
45 | * @link http://php.net/manual/en/iterator.current.php |
||
46 | * @return mixed |
||
47 | */ |
||
48 | 6 | public function current() { |
|
51 | |||
52 | /** |
||
53 | * Move forward to next element |
||
54 | * @see Iterator::next |
||
55 | * @link http://php.net/manual/en/iterator.next.php |
||
56 | */ |
||
57 | 7 | public function next() { |
|
60 | |||
61 | /** |
||
62 | * Return the key of the current element |
||
63 | * @see Iterator::key |
||
64 | * @link http://php.net/manual/en/iterator.key.php |
||
65 | * @return mixed scalar on success, or null on failure. |
||
66 | */ |
||
67 | 5 | public function key() { |
|
70 | |||
71 | /** |
||
72 | * Checks if current position is valid |
||
73 | * @see Iterator::rewind |
||
74 | * @link http://php.net/manual/en/iterator.valid.php |
||
75 | * @return boolean |
||
76 | */ |
||
77 | 9 | public function valid() { |
|
80 | |||
81 | /** |
||
82 | * Rewind the Iterator to the first element |
||
83 | * @see Iterator::rewind |
||
84 | * @link http://php.net/manual/en/iterator.rewind.php |
||
85 | */ |
||
86 | 9 | public function rewind() { |
|
90 | |||
91 | } |