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() |
|
24 | |||
25 | /** |
||
26 | * Return the key of the current item |
||
27 | * |
||
28 | * @return mixed scalar on success, or null on failure. |
||
29 | */ |
||
30 | 1 | public function key() |
|
34 | |||
35 | /** |
||
36 | * Move forward to next item |
||
37 | */ |
||
38 | 2 | public function next() |
|
42 | |||
43 | /** |
||
44 | * Rewind the collection to the first item |
||
45 | */ |
||
46 | 2 | public function rewind() |
|
52 | |||
53 | /** |
||
54 | * Checks if current position is valid |
||
55 | * |
||
56 | * @return bool Returns true on success or false on failure. |
||
57 | */ |
||
58 | 1 | public function valid(): bool |
|
64 | |||
65 | /** |
||
66 | * Count elements of items in collection |
||
67 | * |
||
68 | * @return int Count |
||
69 | */ |
||
70 | 1 | public function count(): int |
|
74 | } |
||
75 |