1 | <?php |
||
7 | abstract class AbstractIterator implements PackagedResourceIterator |
||
8 | { |
||
9 | |||
10 | /** |
||
11 | * @return \Iterator |
||
12 | */ |
||
13 | abstract protected function buildIterator(); |
||
14 | |||
15 | /** |
||
16 | * @return \Iterator |
||
17 | */ |
||
18 | public function getIterator() |
||
26 | |||
27 | /** |
||
28 | * (PHP 5 >= 5.0.0)<br/> |
||
29 | * Move forward to next element |
||
30 | * @link http://php.net/manual/en/iterator.next.php |
||
31 | * @return void Any returned value is ignored. |
||
32 | */ |
||
33 | public function next() |
||
37 | |||
38 | /** |
||
39 | * (PHP 5 >= 5.0.0)<br/> |
||
40 | * Return the key of the current element |
||
41 | * @link http://php.net/manual/en/iterator.key.php |
||
42 | * @return mixed scalar on success, or null on failure. |
||
43 | */ |
||
44 | public function key() |
||
48 | |||
49 | /** |
||
50 | * (PHP 5 >= 5.0.0)<br/> |
||
51 | * Checks if current position is valid |
||
52 | * @link http://php.net/manual/en/iterator.valid.php |
||
53 | * @return boolean The return value will be casted to boolean and then evaluated. |
||
54 | * Returns true on success or false on failure. |
||
55 | */ |
||
56 | public function valid() |
||
60 | |||
61 | /** |
||
62 | * (PHP 5 >= 5.0.0)<br/> |
||
63 | * Rewind the Iterator to the first element |
||
64 | * @link http://php.net/manual/en/iterator.rewind.php |
||
65 | * @return void Any returned value is ignored. |
||
66 | */ |
||
67 | public function rewind() |
||
71 | |||
72 | |||
73 | } |
||
74 |
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: