@@ 218-232 (lines=15) @@ | ||
215 | /** |
|
216 | * @return array |
|
217 | */ |
|
218 | public function toArray() |
|
219 | { |
|
220 | $array = []; |
|
221 | ||
222 | foreach (array_keys(get_object_vars($this)) as $property) { |
|
223 | $getter = 'get' . ucfirst($property); |
|
224 | if (method_exists($this, $getter)) { |
|
225 | $array[snake_case($property)] = $this->$getter(); |
|
226 | } else { |
|
227 | $array[snake_case($property)] = $this->$property; |
|
228 | } |
|
229 | } |
|
230 | ||
231 | return $array; |
|
232 | } |
|
233 | } |
|
234 |
@@ 242-256 (lines=15) @@ | ||
239 | /** |
|
240 | * @return array |
|
241 | */ |
|
242 | public function toArray() |
|
243 | { |
|
244 | $array = []; |
|
245 | ||
246 | foreach (array_keys(get_object_vars($this)) as $property) { |
|
247 | $getter = 'get' . ucfirst($property); |
|
248 | if (method_exists($this, $getter)) { |
|
249 | $array[snake_case($property)] = $this->$getter(); |
|
250 | } else { |
|
251 | $array[snake_case($property)] = $this->$property; |
|
252 | } |
|
253 | } |
|
254 | ||
255 | return $array; |
|
256 | } |
|
257 | } |
|
258 |