Skip to content

Commit

Permalink
Removed custom modelToArray function
Browse files Browse the repository at this point in the history
  • Loading branch information
felixbessler committed Jan 16, 2025
1 parent 9968cb6 commit 88b7653
Showing 1 changed file with 0 additions and 13 deletions.
13 changes: 0 additions & 13 deletions src/SimpleDTO.php
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,6 @@ private function formatArrayableValue(mixed $value): array|int|string
$value instanceof UnitEnum => $value->name,
$value instanceof Carbon || $value instanceof CarbonImmutable => $value->toISOString(true),
$value instanceof Collection => $this->transformCollectionToArray($value),
$value instanceof Model => $this->transformModelToArray($value),
$value instanceof SimpleDTO => $this->transformDTOToArray($value),
$value instanceof Arrayable => $value->toArray(),
is_object($value) => (array) $value,
Expand All @@ -499,18 +498,6 @@ private function transformCollectionToArray(Collection $collection): array
})->toArray();
}

private function transformModelToArray(Model $model): array
{
$result = [];
foreach ($model->getAttributes() as $key => $value) {
$result[$key] = $this->isArrayable($value)
? $this->formatArrayableValue($value)
: $value;
}

return $result;
}

private function transformDTOToArray(SimpleDTO $dto): array
{
$result = [];
Expand Down

0 comments on commit 88b7653

Please sign in to comment.