1 | <?php |
||
7 | abstract class AbstractObjectContainer extends AbstractGeneratorAware implements \ArrayAccess, \Iterator, \Countable, \JsonSerializable |
||
8 | { |
||
9 | /** |
||
10 | * @var string |
||
11 | */ |
||
12 | const PROPERTY_NAME = 'name'; |
||
13 | /** |
||
14 | * @var array |
||
15 | */ |
||
16 | protected $objects = array(); |
||
17 | /** |
||
18 | * @var int |
||
19 | */ |
||
20 | protected $offset = 0; |
||
21 | /** |
||
22 | * @param string $offset |
||
23 | * @return bool |
||
24 | */ |
||
25 | public function offsetExists($offset) |
||
30 | /** |
||
31 | * @param int $offset |
||
32 | * @return mixed |
||
33 | */ |
||
34 | public function offsetGet($offset) |
||
39 | /** |
||
40 | * @param string $offset |
||
41 | * @param mixed $value |
||
42 | * @return AbstractObjectContainer |
||
43 | */ |
||
44 | public function offsetSet($offset, $value) |
||
48 | /** |
||
49 | * @param string $offset |
||
50 | * @return AbstractObjectContainer |
||
51 | */ |
||
52 | public function offsetUnset($offset) |
||
59 | /** |
||
60 | * @return mixed |
||
61 | */ |
||
62 | public function current() |
||
67 | /** |
||
68 | * @return void |
||
69 | */ |
||
70 | public function next() |
||
74 | /** |
||
75 | * @return int |
||
76 | */ |
||
77 | public function key() |
||
81 | /** |
||
82 | * @return bool |
||
83 | */ |
||
84 | public function valid() |
||
88 | /** |
||
89 | * @return AbstractObjectContainer |
||
90 | */ |
||
91 | public function rewind() |
||
96 | /** |
||
97 | * @return int |
||
98 | */ |
||
99 | public function count() |
||
103 | /** |
||
104 | * Must return the object class name that this container is made to contain |
||
105 | * @return string |
||
106 | */ |
||
107 | abstract protected function objectClass(); |
||
108 | /** |
||
109 | * Must return the object class name that this container is made to contain |
||
110 | * @return string |
||
111 | */ |
||
112 | abstract protected function objectProperty(); |
||
113 | /** |
||
114 | * This method is called before the object has been stored |
||
115 | * @throws \InvalidArgumentException |
||
116 | * @param mixed $object |
||
117 | */ |
||
118 | protected function beforeObjectIsStored($object) |
||
128 | /** |
||
129 | * @param object $object |
||
130 | * @throws \InvalidArgumentException |
||
131 | * @return string |
||
132 | */ |
||
133 | private function getObjectKey($object) |
||
145 | /** |
||
146 | * @throws \InvalidArgumentException |
||
147 | * @param mixed $object |
||
148 | * @return AbstractObjectContainer |
||
149 | */ |
||
150 | public function add($object) |
||
156 | /** |
||
157 | * @param string $value |
||
158 | * @return mixed |
||
159 | */ |
||
160 | public function get($value) |
||
171 | } |
||
172 |