1 | <?php |
||
21 | abstract class ArrayCollection implements CollectionInterface, \ArrayAccess |
||
22 | { |
||
23 | /** |
||
24 | * @var array |
||
25 | */ |
||
26 | protected $elements = array(); |
||
27 | |||
28 | /** |
||
29 | * AbstractArrayCollection constructor. |
||
30 | * |
||
31 | * @param array $elements |
||
32 | */ |
||
33 | public function __construct(array $elements = array()) |
||
37 | |||
38 | /** |
||
39 | * {@inheritdoc} |
||
40 | */ |
||
41 | public function clear() |
||
45 | |||
46 | /** |
||
47 | * {@inheritdoc} |
||
48 | */ |
||
49 | public function count() |
||
53 | |||
54 | /** |
||
55 | * {@inheritdoc} |
||
56 | */ |
||
57 | public function isEmpty() |
||
61 | |||
62 | /** |
||
63 | * {@inheritdoc} |
||
64 | */ |
||
65 | public function getIterator() |
||
69 | |||
70 | /** |
||
71 | * {@inheritdoc} |
||
72 | */ |
||
73 | public function toArray() |
||
77 | |||
78 | /** |
||
79 | * {@inheritdoc} |
||
80 | */ |
||
81 | public function slice($offset, $length = null) |
||
85 | |||
86 | /** |
||
87 | * {@inheritdoc} |
||
88 | */ |
||
89 | protected function hasKey($key) |
||
95 | |||
96 | /** |
||
97 | * {@inheritdoc} |
||
98 | */ |
||
99 | public function offsetExists($offset) |
||
103 | |||
104 | /** |
||
105 | * {@inheritdoc} |
||
106 | */ |
||
107 | public function offsetGet($offset) |
||
113 | |||
114 | /** |
||
115 | * {@inheritdoc} |
||
116 | */ |
||
117 | public function offsetSet($offset, $value) |
||
123 | |||
124 | /** |
||
125 | * {@inheritdoc} |
||
126 | */ |
||
127 | public function offsetUnset($offset) |
||
135 | |||
136 | /** |
||
137 | * Validates that a key is valid. |
||
138 | * |
||
139 | * @param int|string $key |
||
140 | * |
||
141 | * @return bool |
||
142 | * |
||
143 | * @throws InvalidKeyException If the key is invalid. |
||
144 | */ |
||
145 | protected function validateKey($key) |
||
153 | |||
154 | /** |
||
155 | * Validates that the argument is traversable. |
||
156 | * |
||
157 | * @param array|\Traversable $elements |
||
158 | * |
||
159 | * @return bool |
||
160 | * |
||
161 | * @throws \InvalidArgumentException. |
||
162 | */ |
||
163 | protected function validateTraversable($elements) |
||
176 | } |
||
177 |