From 78841ad9d6ba20c5679f13c37d6965fe9c323ef8 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Thu, 13 Jan 2022 20:54:29 +0000 Subject: [PATCH] refactor: add RsvpResponse --- src/RsvpResponse.php | 11 +++++++++++ tests/FakeEventRepository.php | 12 +++++++----- 2 files changed, 18 insertions(+), 5 deletions(-) create mode 100644 src/RsvpResponse.php diff --git a/src/RsvpResponse.php b/src/RsvpResponse.php new file mode 100644 index 0000000..4d5c6f9 --- /dev/null +++ b/src/RsvpResponse.php @@ -0,0 +1,11 @@ + 'matthew s.', 'response' => 'yes'], - ['name' => 'Michael P.', 'response' => 'yes'], - ['name' => 'Kathryn "Kat" R.', 'response' => 'yes'], - ['name' => 'Did not attend', 'response' => 'no'], + ['name' => 'matthew s.', 'response' => RsvpResponse::RESPONSE_YES], + ['name' => 'Michael P.', 'response' => RsvpResponse::RESPONSE_YES], + ['name' => 'Kathryn "Kat" R.', 'response' => RsvpResponse::RESPONSE_YES], + ['name' => 'Did not attend', 'response' => RsvpResponse::RESPONSE_NO], ]; public function getConfirmedAttendees(): Collection { return Collection::make(self::$rsvps) - ->filter(fn (array $attendee): bool => $attendee['response'] == 'yes') + ->filter(fn (array $attendee): bool => $attendee['response'] + == RsvpResponse::RESPONSE_YES) ; } }