From 68de1fd224caaef80cba708520920d7ca3d523f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Munsch?= Date: Fri, 14 Aug 2026 12:15:52 +0200 Subject: [PATCH] refactor(dto): simplify toArray method in IncoSheetDto Removed unnecessary comments and streamlined the mapping of allergens and additives. --- src/Presentation/Api/V1/Dto/IncoSheets/IncoSheetDto.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/Presentation/Api/V1/Dto/IncoSheets/IncoSheetDto.php b/src/Presentation/Api/V1/Dto/IncoSheets/IncoSheetDto.php index 0adcdc2..aad7182 100644 --- a/src/Presentation/Api/V1/Dto/IncoSheets/IncoSheetDto.php +++ b/src/Presentation/Api/V1/Dto/IncoSheets/IncoSheetDto.php @@ -128,11 +128,9 @@ final readonly class IncoSheetDto implements ApiResponseDto /** @var array $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();