Skip to content

Commit

Permalink
Add OrganizerMapper
Browse files Browse the repository at this point in the history
  • Loading branch information
vhande committed Jun 27, 2024
1 parent 2a88221 commit 327a8a8
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions app/Domain/Integrations/Mappers/OrganizerMapper.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

declare(strict_types=1);

namespace App\Domain\Integrations\Mappers;

use App\Domain\Integrations\FormRequests\GetOrganizersRequest;
use App\Domain\Integrations\Organizer;
use Ramsey\Uuid\Uuid;

final class OrganizerMapper
{
/**
* @return Organizer[]
*/
public static function map(GetOrganizersRequest $request, string $id): array
{
/**
* @var Organizer[] $organizers
*/
$organizers = [];

foreach ($request->input('organizers') ?? [] as $organizer) {
$organizers[] = new Organizer(
Uuid::uuid4(),
Uuid::fromString($id),
Uuid::fromString($organizer['id'])
);
}

return $organizers;
}
}

0 comments on commit 327a8a8

Please sign in to comment.