Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
5 / 5
100.00% covered (success)
100.00%
2 / 2
CRAP
100.00% covered (success)
100.00%
1 / 1
TripMembersView
100.00% covered (success)
100.00%
5 / 5
100.00% covered (success)
100.00%
2 / 2
2
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 toArray
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3declare(strict_types=1);
4
5namespace App\Trip\Application\Query;
6
7/**
8 * The people on a trip: the owner + editor/viewer members, plus (for the owner
9 * only) the still-pending invitations. Identity fields come from MemberDirectory.
10 */
11final readonly class TripMembersView
12{
13    /**
14     * @param list<array{userId: string, email: string, name: string, role: string, avatarUrl: string|null}> $members
15     * @param list<array{id: string, email: string, name: string, role: string}> $pendingInvitations
16     */
17    public function __construct(
18        public array $members,
19        public array $pendingInvitations,
20    ) {
21    }
22
23    /**
24     * @return array{members: list<array{userId: string, email: string, name: string, role: string, avatarUrl: string|null}>, pendingInvitations: list<array{id: string, email: string, name: string, role: string}>}
25     */
26    public function toArray(): array
27    {
28        return [
29            'members' => $this->members,
30            'pendingInvitations' => $this->pendingInvitations,
31        ];
32    }
33}