| @@ 280-286 (lines=7) @@ | ||
| 277 | */ |
|
| 278 | public function castFields($fields = null, array $data = []): array |
|
| 279 | { |
|
| 280 | if (!empty($fields)) { |
|
| 281 | if (is_string($fields)) { |
|
| 282 | $fields = preg_split("/[\s,]+/", strtolower($fields)); |
|
| 283 | } else if (!is_array($fields)) { |
|
| 284 | $fields = []; |
|
| 285 | } |
|
| 286 | } |
|
| 287 | ||
| 288 | if (empty($data) || !is_array($data)) { |
|
| 289 | $data = $this->cast(); |
|
| @@ 319-325 (lines=7) @@ | ||
| 316 | */ |
|
| 317 | public function exportArray($fields = null, array $data = []): array |
|
| 318 | { |
|
| 319 | if (!empty($fields)) { |
|
| 320 | if (is_string($fields)) { |
|
| 321 | $fields = preg_split("/[\s,]+/", strtolower($fields)); |
|
| 322 | } else if (!is_array($fields)) { |
|
| 323 | $fields = []; |
|
| 324 | } |
|
| 325 | } |
|
| 326 | ||
| 327 | if (empty($data) || !is_array($data)) { |
|
| 328 | $data = $this->cast(); |
|