1 | <?php |
||
7 | class ObjectStorage implements PrimitiveInterface, \Countable, \Iterator, \ArrayAccess, \Serializable |
||
8 | { |
||
9 | private $objects; |
||
10 | |||
11 | 16 | public function __construct(\SplObjectStorage $objects = null) |
|
16 | |||
17 | /** |
||
18 | * {@inheritdoc} |
||
19 | */ |
||
20 | 4 | public function toPrimitive() |
|
25 | |||
26 | /** |
||
27 | * Merge storages |
||
28 | * |
||
29 | * @param self $storage |
||
30 | * |
||
31 | * @return self |
||
32 | */ |
||
33 | 1 | public function merge(self $storage) |
|
41 | |||
42 | /** |
||
43 | * Attach a new element to the storage |
||
44 | * |
||
45 | * @param object $object |
||
46 | * @param mixed $data |
||
47 | * |
||
48 | * @return self |
||
49 | */ |
||
50 | 13 | public function attach($object, $data = null) |
|
57 | |||
58 | /** |
||
59 | * Check if the object is in this storage |
||
60 | * |
||
61 | * @param object $object |
||
62 | * |
||
63 | * @return bool |
||
64 | */ |
||
65 | 4 | public function contains($object) |
|
69 | |||
70 | /** |
||
71 | * Remove the given object from the storage |
||
72 | * |
||
73 | * @param object $object |
||
74 | * |
||
75 | * @return self |
||
76 | */ |
||
77 | 1 | public function detach($object) |
|
84 | |||
85 | /** |
||
86 | * Get the internal has for the given object |
||
87 | * |
||
88 | * @param object $object |
||
89 | * |
||
90 | * @return string |
||
91 | */ |
||
92 | 1 | public function getHash($object) |
|
96 | |||
97 | /** |
||
98 | * Return the info associated to the current object pointed by the internal pointer |
||
99 | * |
||
100 | * @return mixed |
||
101 | */ |
||
102 | 1 | public function getInfo() |
|
106 | |||
107 | /** |
||
108 | * Remove all the elements contained in the given storage from the current one |
||
109 | * |
||
110 | * @param self $storage |
||
111 | * |
||
112 | * @return self |
||
113 | */ |
||
114 | 1 | public function removeAll(self $storage) |
|
121 | |||
122 | /** |
||
123 | * Remove all elements not contained in the given storage |
||
124 | * |
||
125 | * @param self $storage |
||
126 | * |
||
127 | * @return self |
||
128 | */ |
||
129 | 1 | public function removeAllExcept(self $storage) |
|
136 | |||
137 | /** |
||
138 | * Associate data to the current object |
||
139 | * |
||
140 | * @param mixed $data |
||
141 | * |
||
142 | * @return self |
||
143 | */ |
||
144 | 1 | public function setInfo($data) |
|
152 | |||
153 | /** |
||
154 | * {@inheritdoc} |
||
155 | */ |
||
156 | 6 | public function count() |
|
160 | |||
161 | /** |
||
162 | * {@inheritdoc} |
||
163 | */ |
||
164 | 1 | public function current() |
|
168 | |||
169 | /** |
||
170 | * {@inheritdoc} |
||
171 | */ |
||
172 | 2 | public function next() |
|
176 | |||
177 | /** |
||
178 | * {@inheritdoc} |
||
179 | */ |
||
180 | 1 | public function key() |
|
184 | |||
185 | /** |
||
186 | * {@inheritdoc} |
||
187 | */ |
||
188 | 1 | public function rewind() |
|
192 | |||
193 | /** |
||
194 | * {@inheritdoc} |
||
195 | */ |
||
196 | 1 | public function valid() |
|
200 | |||
201 | /** |
||
202 | * {@inheritdoc} |
||
203 | */ |
||
204 | 1 | public function offsetExists($object) |
|
208 | |||
209 | /** |
||
210 | * {@inheritdoc} |
||
211 | */ |
||
212 | 1 | public function offsetGet($object) |
|
216 | |||
217 | /** |
||
218 | * {@inheritdoc} |
||
219 | */ |
||
220 | 1 | public function offsetSet($object, $data = null) |
|
226 | |||
227 | /** |
||
228 | * {@inheritdoc} |
||
229 | */ |
||
230 | 1 | public function offsetUnset($object) |
|
236 | |||
237 | /** |
||
238 | * {@inheritdoc} |
||
239 | */ |
||
240 | 1 | public function serialize() |
|
244 | |||
245 | /** |
||
246 | * {@inheritdoc} |
||
247 | */ |
||
248 | 1 | public function unserialize($serialized) |
|
255 | } |
||
256 |