refactor(dto): simplify toArray method in IncoSheetDto

Removed unnecessary comments and streamlined the mapping of allergens and additives.
This commit is contained in:
Jérémy Munsch 2026-08-14 12:15:52 +02:00
parent 195227a443
commit 68de1fd224
Signed by: forge-joniko
GPG key ID: D7EFE2F5CB6CC0E4

View file

@ -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();