refactor: move RSVPs into a static property
This commit is contained in:
parent
6a82fccecd
commit
aadb1e0176
|
@ -9,15 +9,15 @@ use Tightenco\Collect\Support\Collection;
|
|||
|
||||
final class FakeEventRepository implements EventRepository
|
||||
{
|
||||
public function getConfirmedAttendees(): Collection {
|
||||
$rsvps = Collection::make([
|
||||
['name' => 'matthew s.', 'response' => 'yes'],
|
||||
['name' => 'Michael P.', 'response' => 'yes'],
|
||||
['name' => 'Kathryn "Kat" R.', 'response' => 'yes'],
|
||||
['name' => 'Did not attend', 'response' => 'no'],
|
||||
]);
|
||||
private static array $rsvps = [
|
||||
['name' => 'matthew s.', 'response' => 'yes'],
|
||||
['name' => 'Michael P.', 'response' => 'yes'],
|
||||
['name' => 'Kathryn "Kat" R.', 'response' => 'yes'],
|
||||
['name' => 'Did not attend', 'response' => 'no'],
|
||||
];
|
||||
|
||||
return $rsvps
|
||||
public function getConfirmedAttendees(): Collection {
|
||||
return Collection::make(self::$rsvps)
|
||||
->filter(fn (array $attendee): bool => $attendee['response'] == 'yes')
|
||||
;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue