Total Complexity | 9 |
Total Lines | 79 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
5 | abstract class Collection implements \Iterator, \Countable, \JsonSerializable |
||
6 | { |
||
7 | /** |
||
8 | * @var array |
||
9 | */ |
||
10 | private $items; |
||
11 | |||
12 | /** |
||
13 | * @param array $items |
||
14 | */ |
||
15 | final protected function __construct(array $items) |
||
16 | { |
||
17 | $this->items = $items; |
||
18 | } |
||
19 | |||
20 | /** |
||
21 | * @return mixed |
||
22 | */ |
||
23 | public function current() |
||
26 | } |
||
27 | |||
28 | /** |
||
29 | * @return void |
||
30 | */ |
||
31 | public function next() |
||
32 | { |
||
33 | \next($this->items); |
||
34 | } |
||
35 | |||
36 | /** |
||
37 | * @return int|mixed|string|null |
||
38 | */ |
||
39 | public function key() |
||
40 | { |
||
41 | return \key($this->items); |
||
42 | } |
||
43 | |||
44 | /** |
||
45 | * @return bool |
||
46 | */ |
||
47 | public function valid() |
||
48 | { |
||
49 | return \array_key_exists($this->key(), $this->items); |
||
50 | } |
||
51 | |||
52 | /** |
||
53 | * @return void |
||
54 | */ |
||
55 | public function rewind() |
||
56 | { |
||
57 | \reset($this->items); |
||
58 | } |
||
59 | |||
60 | /** |
||
61 | * @return int|void |
||
62 | */ |
||
63 | public function count() |
||
64 | { |
||
65 | return \count($this->items); |
||
66 | } |
||
67 | |||
68 | /** |
||
69 | * @return array |
||
70 | */ |
||
71 | public function jsonSerialize() |
||
72 | { |
||
73 | return $this->items; |
||
74 | } |
||
75 | |||
76 | /** |
||
77 | * @param array $items |
||
78 | * |
||
79 | * @return static |
||
80 | */ |
||
81 | public static function from(array $items) |
||
84 | } |
||
85 | } |
||
86 |