| @@ 314-320 (lines=7) @@ | ||
| 311 | */ |
|
| 312 | public function castFields($fields = null, array $data = []): array |
|
| 313 | { |
|
| 314 | if (!empty($fields)) { |
|
| 315 | if (is_string($fields)) { |
|
| 316 | $fields = preg_split("/[\s,]+/", strtolower($fields)); |
|
| 317 | } else if (!is_array($fields)) { |
|
| 318 | $fields = []; |
|
| 319 | } |
|
| 320 | } |
|
| 321 | ||
| 322 | if (empty($data) || !is_array($data)) { |
|
| 323 | $data = $this->cast(); |
|
| @@ 353-359 (lines=7) @@ | ||
| 350 | */ |
|
| 351 | public function exportArray($fields = null, array $data = []): array |
|
| 352 | { |
|
| 353 | if (!empty($fields)) { |
|
| 354 | if (is_string($fields)) { |
|
| 355 | $fields = preg_split("/[\s,]+/", strtolower($fields)); |
|
| 356 | } else if (!is_array($fields)) { |
|
| 357 | $fields = []; |
|
| 358 | } |
|
| 359 | } |
|
| 360 | ||
| 361 | if (empty($data) || !is_array($data)) { |
|
| 362 | $data = $this->cast(); |
|