1 | <?php |
||
31 | class ArrayResourceCollection implements IteratorAggregate, ResourceCollection |
||
32 | { |
||
33 | /** |
||
34 | * @var PuliResource[]|Traversable |
||
35 | */ |
||
36 | private $resources; |
||
37 | |||
38 | /** |
||
39 | * Creates a new collection. |
||
40 | * |
||
41 | * You can pass the resources that you want to initially store in the |
||
42 | * collection as argument. |
||
43 | * |
||
44 | * @param PuliResource[]|Traversable $resources The resources to store in the collection. |
||
45 | * |
||
46 | * @throws InvalidArgumentException If the resources are not an array |
||
47 | * and not a traversable object. |
||
48 | * @throws UnsupportedResourceException If a resource does not implement |
||
49 | * {@link PuliResource}. |
||
50 | */ |
||
51 | 692 | public function __construct($resources = array()) |
|
55 | |||
56 | /** |
||
57 | * {@inheritdoc} |
||
58 | */ |
||
59 | 4 | public function add(PuliResource $resource) |
|
63 | |||
64 | /** |
||
65 | * {@inheritdoc} |
||
66 | */ |
||
67 | 97 | public function set($key, PuliResource $resource) |
|
71 | |||
72 | /** |
||
73 | * {@inheritdoc} |
||
74 | */ |
||
75 | 83 | public function get($key) |
|
86 | |||
87 | /** |
||
88 | * {@inheritdoc} |
||
89 | */ |
||
90 | 2 | public function remove($key) |
|
94 | |||
95 | /** |
||
96 | * {@inheritdoc} |
||
97 | */ |
||
98 | 1 | public function has($key) |
|
102 | |||
103 | /** |
||
104 | * {@inheritdoc} |
||
105 | */ |
||
106 | 1 | public function clear() |
|
110 | |||
111 | /** |
||
112 | * {@inheritdoc} |
||
113 | */ |
||
114 | public function keys() |
||
118 | |||
119 | /** |
||
120 | * {@inheritdoc} |
||
121 | */ |
||
122 | 692 | public function replace($resources) |
|
128 | |||
129 | /** |
||
130 | * {@inheritdoc} |
||
131 | */ |
||
132 | 3 | public function merge($resources) |
|
141 | |||
142 | /** |
||
143 | * {@inheritdoc} |
||
144 | */ |
||
145 | 1 | public function isEmpty() |
|
149 | |||
150 | /** |
||
151 | * {@inheritdoc} |
||
152 | */ |
||
153 | public function offsetExists($key) |
||
157 | |||
158 | /** |
||
159 | * {@inheritdoc} |
||
160 | */ |
||
161 | 73 | public function offsetGet($key) |
|
165 | |||
166 | /** |
||
167 | * {@inheritdoc} |
||
168 | */ |
||
169 | 97 | public function offsetSet($key, $value) |
|
177 | |||
178 | /** |
||
179 | * {@inheritdoc} |
||
180 | */ |
||
181 | public function offsetUnset($key) |
||
185 | |||
186 | /** |
||
187 | * {@inheritdoc} |
||
188 | */ |
||
189 | public function getPaths() |
||
198 | |||
199 | /** |
||
200 | * {@inheritdoc} |
||
201 | */ |
||
202 | public function getNames() |
||
211 | |||
212 | 145 | public function count() |
|
216 | |||
217 | 640 | public function getIterator($mode = ResourceCollectionIterator::KEY_AS_CURSOR) |
|
221 | |||
222 | 669 | public function toArray() |
|
226 | } |
||
227 |