1 | <?php declare(strict_types=1); |
||
10 | class Collection implements CollectionInterface, \Countable |
||
11 | { |
||
12 | /** |
||
13 | * @var mixed[] |
||
14 | */ |
||
15 | protected $values = []; |
||
16 | |||
17 | /** |
||
18 | * @param mixed[] $collection |
||
19 | */ |
||
20 | 63 | public function __construct(array $collection = []) |
|
24 | |||
25 | /** |
||
26 | * {@inheritdoc} |
||
27 | * |
||
28 | * @throws \InvalidArgumentException |
||
29 | */ |
||
30 | 46 | public function get(string $name) |
|
38 | |||
39 | /** |
||
40 | * {@inheritdoc} |
||
41 | */ |
||
42 | 58 | public function has(string $name): bool |
|
46 | |||
47 | /** |
||
48 | * {@inheritdoc} |
||
49 | */ |
||
50 | 56 | public function set(string $name, $object) |
|
54 | |||
55 | /** |
||
56 | * {@inheritdoc} |
||
57 | */ |
||
58 | 31 | public function getIterator() |
|
62 | |||
63 | /** |
||
64 | * {@inheritdoc} |
||
65 | */ |
||
66 | 23 | public function offsetExists($offset): bool |
|
70 | |||
71 | /** |
||
72 | * {@inheritdoc} |
||
73 | */ |
||
74 | 30 | public function offsetGet($offset) |
|
78 | |||
79 | /** |
||
80 | * {@inheritdoc} |
||
81 | */ |
||
82 | 42 | public function offsetSet($offset, $value) |
|
86 | |||
87 | /** |
||
88 | * {@inheritdoc} |
||
89 | */ |
||
90 | 1 | public function offsetUnset($offset) |
|
94 | |||
95 | /** |
||
96 | * {@inheritdoc} |
||
97 | */ |
||
98 | 1 | public function count(): int |
|
102 | |||
103 | /** |
||
104 | * @return mixed[] |
||
105 | */ |
||
106 | 3 | public function select(callable $callback): array |
|
118 | |||
119 | /** |
||
120 | * @return mixed |
||
121 | * @throws \InvalidArgumentException |
||
122 | */ |
||
123 | public function first() |
||
131 | |||
132 | /** |
||
133 | * @return mixed[] |
||
134 | */ |
||
135 | public function toArray(): array |
||
139 | |||
140 | 1 | protected function throwNotFound(string $name) |
|
144 | } |
||
145 |