@@ -52,8 +52,7 @@ public function __construct(
5252 private readonly string $ dateFormat ,
5353 private readonly string $ timezone ,
5454 private readonly int $ cacheExpireSeconds ,
55- )
56- {
55+ ) {
5756 $ this ->mappings = $ this ->createMappings ($ this ->customMappings );
5857 }
5958
@@ -104,7 +103,7 @@ public function getData(Feed $feed): array
104103 }, $ modifiedResults );
105104
106105 // Sort bookings by start time.
107- usort ($ resultsAsArray , fn (array $ a , array $ b ) => $ a ['startTime ' ] > $ b ['startTime ' ] ? 1 : -1 );
106+ usort ($ resultsAsArray , fn (array $ a , array $ b ) => $ a ['startTime ' ] > $ b ['startTime ' ] ? 1 : -1 );
108107
109108 return $ resultsAsArray ;
110109 } catch (\Throwable $ throwable ) {
@@ -227,24 +226,24 @@ public function getConfigOptions(Request $request, FeedSource $feedSource, strin
227226 $ resources = array_merge ($ resources , $ locationResources );
228227 }
229228
230- $ resourceOptions = array_map (fn (Resource $ resource ) => [
229+ $ resourceOptions = array_map (fn (Resource $ resource ) => [
231230 'id ' => Ulid::generate (),
232231 'title ' => $ resource ->displayName ,
233232 'value ' => $ resource ->id ,
234233 ], $ resources );
235234
236235 // Sort resource options by title.
237- usort ($ resourceOptions , fn ($ a , $ b ) => strcmp ((string )$ a ['title ' ], (string )$ b ['title ' ]));
236+ usort ($ resourceOptions , fn ($ a , $ b ) => strcmp ((string ) $ a ['title ' ], (string ) $ b ['title ' ]));
238237
239238 return $ resourceOptions ;
240239 } elseif ('locations ' === $ name ) {
241- $ locationOptions = array_map (fn (Location $ location ) => [
240+ $ locationOptions = array_map (fn (Location $ location ) => [
242241 'id ' => Ulid::generate (),
243242 'title ' => $ location ->displayName ,
244243 'value ' => $ location ->id ,
245244 ], $ this ->loadLocations ());
246245
247- usort ($ locationOptions , fn ($ a , $ b ) => strcmp ((string )$ a ['title ' ], (string )$ b ['title ' ]));
246+ usort ($ locationOptions , fn ($ a , $ b ) => strcmp ((string ) $ a ['title ' ], (string ) $ b ['title ' ]));
248247
249248 return $ locationOptions ;
250249 }
@@ -292,12 +291,12 @@ private function getLocationOptions(): array
292291
293292 private function getResourceEvents (string $ resourceId ): array
294293 {
295- $ cacheItem = $ this ->calendarApiCache ->getItem (self ::CACHE_KEY_EVENTS . '- ' . $ resourceId );
294+ $ cacheItem = $ this ->calendarApiCache ->getItem (self ::CACHE_KEY_EVENTS . '- ' . $ resourceId );
296295
297296 if (!$ cacheItem ->isHit ()) {
298297 $ allEvents = $ this ->loadEvents ();
299298
300- $ items = array_filter ($ allEvents , fn (CalendarEvent $ item ) => $ item ->resourceId === $ resourceId );
299+ $ items = array_filter ($ allEvents , fn (CalendarEvent $ item ) => $ item ->resourceId === $ resourceId );
301300
302301 $ cacheItem ->set ($ items );
303302 $ cacheItem ->expiresAfter ($ this ->cacheExpireSeconds );
@@ -309,12 +308,12 @@ private function getResourceEvents(string $resourceId): array
309308
310309 private function getLocationResources (string $ locationId ): array
311310 {
312- $ cacheItem = $ this ->calendarApiCache ->getItem (self ::CACHE_KEY_RESOURCES . '- ' . $ locationId );
311+ $ cacheItem = $ this ->calendarApiCache ->getItem (self ::CACHE_KEY_RESOURCES . '- ' . $ locationId );
313312
314313 if (!$ cacheItem ->isHit ()) {
315314 $ allResources = $ this ->loadResources ();
316315
317- $ items = array_filter ($ allResources , fn (Resource $ item ) => $ item ->locationId === $ locationId );
316+ $ items = array_filter ($ allResources , fn (Resource $ item ) => $ item ->locationId === $ locationId );
318317
319318 $ cacheItem ->set ($ items );
320319 $ cacheItem ->expiresAfter ($ this ->cacheExpireSeconds );
@@ -334,7 +333,7 @@ private function loadLocations(): array
334333
335334 $ LocationEntries = $ response ->toArray ();
336335
337- $ locations = array_map (fn (array $ entry ) => new Location (
336+ $ locations = array_map (fn (array $ entry ) => new Location (
338337 $ entry [$ this ->getMapping ('locationId ' )],
339338 $ entry [$ this ->getMapping ('locationDisplayName ' )],
340339 ), $ LocationEntries );
@@ -473,7 +472,7 @@ private function getMapping(string $key): string
473472
474473 private function shouldFetchNewData (string $ cacheKey ): bool
475474 {
476- $ latestRequestCacheItem = $ this ->calendarApiCache ->getItem ($ cacheKey . self ::CACHE_LATEST_REQUEST_SUFFIX );
475+ $ latestRequestCacheItem = $ this ->calendarApiCache ->getItem ($ cacheKey. self ::CACHE_LATEST_REQUEST_SUFFIX );
477476 $ latestRequest = $ latestRequestCacheItem ->get ();
478477
479478 return null === $ latestRequest || $ latestRequest <= time () - $ this ->cacheExpireSeconds ;
0 commit comments