@@ -63,8 +63,6 @@ public function __construct(
6363 public function getData (Feed $ feed ): array
6464 {
6565 try {
66- $ results = [];
67-
6866 $ configuration = $ feed ->getConfiguration ();
6967
7068 $ enabledModifiers = $ configuration ['enabledModifiers ' ] ?? [];
@@ -76,25 +74,28 @@ public function getData(Feed $feed): array
7674 }
7775
7876 $ resources = $ configuration ['resources ' ];
79- foreach ($ resources as $ resource ) {
80- $ events = $ this ->getResourceEvents ($ resource );
8177
82- $ results += static ::applyModifiersToEvents ($ events , $ this ->eventModifiers , $ enabledModifiers );
78+ $ events = [];
79+
80+ foreach ($ resources as $ resource ) {
81+ $ events += $ this ->getResourceEvents ($ resource );
8382 }
8483
85- $ results = array_map (fn (CalendarEvent $ event ) => [
84+ $ modifiedResults = static ::applyModifiersToEvents ($ events , $ this ->eventModifiers , $ enabledModifiers );
85+
86+ $ resultsAsArray = array_map (fn (CalendarEvent $ event ) => [
8687 'id ' => Ulid::generate (),
8788 'title ' => $ event ->title ,
8889 'startTime ' => $ event ->startTimeTimestamp ,
8990 'endTime ' => $ event ->endTimeTimestamp ,
9091 'resourceTitle ' => $ event ->resourceDisplayName ,
9192 'resourceId ' => $ event ->resourceId ,
92- ], $ results );
93+ ], $ modifiedResults );
9394
9495 // Sort bookings by start time.
95- usort ($ results , fn (array $ a , array $ b ) => $ a ['startTime ' ] > $ b ['startTime ' ] ? 1 : -1 );
96+ usort ($ resultsAsArray , fn (array $ a , array $ b ) => $ a ['startTime ' ] > $ b ['startTime ' ] ? 1 : -1 );
9697
97- return $ results ;
98+ return $ resultsAsArray ;
9899 } catch (\Throwable $ throwable ) {
99100 $ this ->logger ->error ('{code}: {message} ' , [
100101 'code ' => $ throwable ->getCode (),
0 commit comments