| 1 | <?php |
||
| 10 | class Collection implements \Iterator, \Countable |
||
| 11 | { |
||
| 12 | |||
| 13 | protected $collection = []; |
||
| 14 | |||
| 15 | /** |
||
| 16 | * Return the current item |
||
| 17 | * |
||
| 18 | * @return false|mixed Item |
||
| 19 | */ |
||
| 20 | 1 | public function current() |
|
| 26 | |||
| 27 | /** |
||
| 28 | * Return the key of the current item |
||
| 29 | * |
||
| 30 | * @return mixed scalar on success, or null on failure. |
||
| 31 | */ |
||
| 32 | 1 | public function key() |
|
| 38 | |||
| 39 | /** |
||
| 40 | * Move forward to next item |
||
| 41 | */ |
||
| 42 | 2 | public function next() |
|
| 46 | |||
| 47 | /** |
||
| 48 | * Rewind the collection to the first item |
||
| 49 | */ |
||
| 50 | 2 | public function rewind() |
|
| 56 | |||
| 57 | /** |
||
| 58 | * Checks if current position is valid |
||
| 59 | * |
||
| 60 | * @return bool Returns true on success or false on failure. |
||
| 61 | */ |
||
| 62 | 1 | public function valid(): bool |
|
| 72 | |||
| 73 | /** |
||
| 74 | * Count elements of items in collection |
||
| 75 | * |
||
| 76 | * @return int Count |
||
| 77 | */ |
||
| 78 | 1 | public function count(): int |
|
| 84 | } |
||
| 85 |