refactor(dto): simplify toArray method in IncoSheetDto
Removed unnecessary comments and streamlined the mapping of allergens and additives.
This commit is contained in:
parent
195227a443
commit
68de1fd224
1 changed files with 0 additions and 2 deletions
|
|
@ -128,11 +128,9 @@ final readonly class IncoSheetDto implements ApiResponseDto
|
|||
/** @var array<string, mixed> $vars */
|
||||
$vars = get_object_vars($this);
|
||||
|
||||
// Map over allergens and additives to call their toArray methods
|
||||
$vars['allergens'] = array_map(static fn (AllergenDto $dto): array => $dto->toArray(), $this->allergens);
|
||||
$vars['additives'] = array_map(static fn (AdditiveDto $dto): array => $dto->toArray(), $this->additives);
|
||||
|
||||
// Call toArray on the nested object DTOs
|
||||
$vars['allegations'] = $this->allegations->toArray();
|
||||
if ($this->portions !== null) {
|
||||
$vars['portions'] = $this->portions->toArray();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue