| @@ 309-315 (lines=7) @@ | ||
| 306 | */ |
|
| 307 | public function castFields($fields = null, array $data = []): array |
|
| 308 | { |
|
| 309 | if (!empty($fields)) { |
|
| 310 | if (is_string($fields)) { |
|
| 311 | $fields = preg_split("/[\s,]+/", strtolower($fields)); |
|
| 312 | } else if (!is_array($fields)) { |
|
| 313 | $fields = []; |
|
| 314 | } |
|
| 315 | } |
|
| 316 | ||
| 317 | if (empty($data) || !is_array($data)) { |
|
| 318 | $data = $this->cast(); |
|
| @@ 348-354 (lines=7) @@ | ||
| 345 | */ |
|
| 346 | public function exportArray($fields = null, array $data = []): array |
|
| 347 | { |
|
| 348 | if (!empty($fields)) { |
|
| 349 | if (is_string($fields)) { |
|
| 350 | $fields = preg_split("/[\s,]+/", strtolower($fields)); |
|
| 351 | } else if (!is_array($fields)) { |
|
| 352 | $fields = []; |
|
| 353 | } |
|
| 354 | } |
|
| 355 | ||
| 356 | if (empty($data) || !is_array($data)) { |
|
| 357 | $data = $this->cast(); |
|