1 | <?php |
||
14 | class IndexedObjectStorage extends \SplObjectStorage { |
||
15 | |||
16 | protected $index = array(); |
||
17 | |||
18 | /** |
||
19 | * Unassign index from object |
||
20 | * |
||
21 | * @param object $object |
||
22 | */ |
||
23 | 1 | protected function indexUnset($object) { |
|
28 | |||
29 | /** |
||
30 | * Function to handle assigning keys |
||
31 | * |
||
32 | * Primary for dealing with duplicates - child can overwrite function to handle duplicates by itself |
||
33 | * |
||
34 | * @param object $object |
||
35 | * @param mixed|null $data - null means remove index |
||
36 | * |
||
37 | * @throws \Exception |
||
38 | */ |
||
39 | 2 | protected function indexSet($object, $data = null) { |
|
52 | |||
53 | /** |
||
54 | * @param mixed $index |
||
55 | * |
||
56 | * @return mixed|null |
||
57 | */ |
||
58 | 1 | public function indexGetObject($index) { |
|
61 | |||
62 | /** |
||
63 | * Rebuild index |
||
64 | */ |
||
65 | 2 | protected function indexRebuild() { |
|
73 | |||
74 | 1 | public function attach($object, $data = null) { |
|
82 | |||
83 | 1 | public function offsetSet($object, $data = null) { |
|
86 | |||
87 | |||
88 | 1 | public function detach($object) { |
|
92 | |||
93 | 1 | public function offsetUnset($object) { |
|
97 | |||
98 | |||
99 | 1 | public function addAll($storage) { |
|
105 | |||
106 | 1 | public function removeAll($storage) { |
|
110 | |||
111 | 1 | public function removeAllExcept($storage) { |
|
116 | |||
117 | 1 | public function unserialize($serialized) { |
|
124 | |||
125 | 1 | public function setInfo($data) { |
|
133 | |||
134 | |||
135 | } |
||
136 |