feat: split summary DTOs into typed sub-objects
This commit is contained in:
1 parent
69705052b3
commit
aa997826f8
18 files changed
+224
-113
No files matched your search
@@ -5,6 +5,7 @@ declare(strict_types=1);
|
||||
namespace App\Service;
|
||||
|
||||
use App\BusProNet\Model\Room;
|
||||
use App\Form\Model\RoomGroupsDto;
|
||||
|
||||
/**
|
||||
* Groups room data for booking steps.
|
||||
@@ -13,10 +14,8 @@ class BookingRoomSelectionService
|
||||
{
|
||||
/**
|
||||
* @param array<int, Room> $rooms
|
||||
*
|
||||
* @return array{by_pax: array<int, Room>, by_room: array<int, Room>}
|
||||
*/
|
||||
public function groupRoomsBySelectionType(array $rooms): array
|
||||
public function groupRoomsBySelectionType(array $rooms): RoomGroupsDto
|
||||
{
|
||||
$groups = [
|
||||
Room::SELECTION_TYPE_BY_PAX => [],
|
||||
@@ -35,6 +34,9 @@ class BookingRoomSelectionService
|
||||
uasort($groups[Room::SELECTION_TYPE_BY_PAX], static fn (Room $a, Room $b): int => $a->maxPax <=> $b->maxPax);
|
||||
uasort($groups[Room::SELECTION_TYPE_BY_ROOM], static fn (Room $a, Room $b): int => $a->maxPax <=> $b->maxPax);
|
||||
|
||||
return $groups;
|
||||
return new RoomGroupsDto(
|
||||
byPax: $groups[Room::SELECTION_TYPE_BY_PAX],
|
||||
byRoom: $groups[Room::SELECTION_TYPE_BY_ROOM],
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user