1 | <?php |
||
5 | abstract class Base implements \ArrayAccess, DataWrapperInterface |
||
6 | { |
||
7 | /** |
||
8 | * Base constructor - you may use an array to initialize the dataWrapper |
||
9 | * |
||
10 | * @param array $data |
||
11 | */ |
||
12 | 11 | public function __construct(array $data = array()) |
|
31 | |||
32 | /** |
||
33 | * Getter and Setters |
||
34 | * |
||
35 | * @param string $name |
||
36 | * @param array $args |
||
37 | */ |
||
38 | 5 | public function __call($name, array $args) |
|
64 | |||
65 | /** |
||
66 | * Export dataWrapper values as an array |
||
67 | * |
||
68 | * @return array |
||
69 | */ |
||
70 | 6 | public function toArray() |
|
91 | |||
92 | /** |
||
93 | * ToArray with unset null fields |
||
94 | * |
||
95 | * @return array |
||
96 | */ |
||
97 | 1 | public function toCleanArray() |
|
110 | |||
111 | /** |
||
112 | * Extract dataWrapper $property value from $data |
||
113 | * |
||
114 | * @param array $data |
||
115 | * @param string $property |
||
116 | * @return |
||
117 | */ |
||
118 | 7 | private function getValue(array $data, $property) |
|
131 | |||
132 | /** |
||
133 | * Convert from undescore to camel case |
||
134 | * |
||
135 | * @param string $name |
||
136 | * @return void |
||
137 | */ |
||
138 | 8 | private function toCamelCase($name) |
|
144 | |||
145 | /** |
||
146 | * Convert from undescore to studly caps |
||
147 | * |
||
148 | * @param string $name |
||
149 | * @return void |
||
150 | */ |
||
151 | 8 | private function toStudlyCaps($name) |
|
155 | |||
156 | /** |
||
157 | * @param string $offset |
||
158 | * @return mixed |
||
159 | */ |
||
160 | 1 | public function offsetGet($offset) |
|
165 | |||
166 | /** |
||
167 | * @param string $offset |
||
168 | * @param mixed $value |
||
169 | * @return mixed |
||
170 | */ |
||
171 | 1 | public function offsetSet($offset, $value) |
|
176 | |||
177 | /** |
||
178 | * @param string |
||
179 | * @return mixed |
||
180 | */ |
||
181 | 1 | public function offsetExists($offset) |
|
186 | |||
187 | /** |
||
188 | * @param string offset |
||
189 | * @return void |
||
190 | */ |
||
191 | 1 | public function offsetUnset($offset) |
|
195 | |||
196 | /** |
||
197 | * @param \ReflectionProperty $property |
||
198 | * @return bool |
||
199 | */ |
||
200 | 7 | public function isCollection(\ReflectionProperty $property) |
|
204 | |||
205 | /** |
||
206 | * @param mixed $value |
||
207 | * @param \ReflectionProperty $property |
||
208 | * @return BaseCollection |
||
209 | */ |
||
210 | 1 | public function toCollection($value, \ReflectionProperty $property) |
|
215 | |||
216 | /** |
||
217 | * @param \ReflectionProperty $property |
||
218 | * @return string |
||
219 | */ |
||
220 | 7 | private function findType(\ReflectionProperty $property) |
|
236 | } |
||
237 |