1 | <?php |
||
5 | class ReplaceableIterator implements \Iterator, \OuterIterator |
||
6 | { |
||
7 | private $index; |
||
8 | |||
9 | public function __construct(\Traversable $iterator = null) |
||
14 | |||
15 | public function setInnerIterator(\Traversable $iterator) |
||
19 | |||
20 | public function getInnerIterator() |
||
24 | |||
25 | public function valid() |
||
29 | |||
30 | public function key() |
||
34 | |||
35 | public function current() |
||
39 | |||
40 | public function rewind() |
||
45 | |||
46 | public function next() |
||
51 | |||
52 | public function getIndex() |
||
56 | |||
57 | public function __call($method, $arguments) |
||
61 | } |
||
62 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: