1 | <?php |
||
10 | abstract class Collection implements Iterator, Countable, ArrayAccess, JsonSerializable |
||
11 | { |
||
12 | protected $items; |
||
13 | protected $key; |
||
14 | |||
15 | 12 | public function __construct(array $items = []) |
|
19 | |||
20 | 1 | public function __clone() |
|
26 | |||
27 | 4 | public function reset(): void |
|
31 | |||
32 | public function replace(array $items = []): void |
||
36 | |||
37 | 12 | public function add($item): void |
|
41 | |||
42 | 11 | public function first() |
|
46 | |||
47 | public function toArray(): array |
||
51 | |||
52 | public function jsonSerialize(): array |
||
58 | |||
59 | 8 | public function count(): int |
|
63 | |||
64 | 1 | public function current() |
|
68 | |||
69 | 1 | public function next() |
|
73 | |||
74 | public function key(): int |
||
75 | { |
||
76 | return key($this->items); |
||
77 | } |
||
78 | |||
79 | 11 | public function valid(): bool |
|
84 | |||
85 | 11 | public function rewind(): void |
|
89 | |||
90 | public function offsetExists($offset): bool |
||
94 | |||
95 | 1 | public function offsetGet($offset) |
|
96 | { |
||
97 | 1 | return $this->items[$offset]; |
|
98 | } |
||
99 | |||
100 | public function offsetSet($offset, $value): void |
||
104 | |||
105 | public function offsetUnset($offset): void |
||
109 | } |
||
110 |