@@ -63,8 +63,6 @@ public function __construct(
63
63
public function getData (Feed $ feed ): array
64
64
{
65
65
try {
66
- $ results = [];
67
-
68
66
$ configuration = $ feed ->getConfiguration ();
69
67
70
68
$ enabledModifiers = $ configuration ['enabledModifiers ' ] ?? [];
@@ -76,25 +74,28 @@ public function getData(Feed $feed): array
76
74
}
77
75
78
76
$ resources = $ configuration ['resources ' ];
79
- foreach ($ resources as $ resource ) {
80
- $ events = $ this ->getResourceEvents ($ resource );
81
77
82
- $ results += static ::applyModifiersToEvents ($ events , $ this ->eventModifiers , $ enabledModifiers );
78
+ $ events = [];
79
+
80
+ foreach ($ resources as $ resource ) {
81
+ $ events += $ this ->getResourceEvents ($ resource );
83
82
}
84
83
85
- $ results = array_map (fn (CalendarEvent $ event ) => [
84
+ $ modifiedResults = static ::applyModifiersToEvents ($ events , $ this ->eventModifiers , $ enabledModifiers );
85
+
86
+ $ resultsAsArray = array_map (fn (CalendarEvent $ event ) => [
86
87
'id ' => Ulid::generate (),
87
88
'title ' => $ event ->title ,
88
89
'startTime ' => $ event ->startTimeTimestamp ,
89
90
'endTime ' => $ event ->endTimeTimestamp ,
90
91
'resourceTitle ' => $ event ->resourceDisplayName ,
91
92
'resourceId ' => $ event ->resourceId ,
92
- ], $ results );
93
+ ], $ modifiedResults );
93
94
94
95
// 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 );
96
97
97
- return $ results ;
98
+ return $ resultsAsArray ;
98
99
} catch (\Throwable $ throwable ) {
99
100
$ this ->logger ->error ('{code}: {message} ' , [
100
101
'code ' => $ throwable ->getCode (),
0 commit comments