A self-hosted media server and file management system
Vue ffmpegfile-serverjellyfinlaravelmediamedia-playermedia-servermediabrowsermediaservermusicmusic-librarymusic-playermusicplayerself-hostedvuejs
chore: code smells
aminnausin82d1c18fe2b1
diff --git a/app/Http/Resources/Pulse/ScheduleResource.php b/app/Http/Resources/Pulse/ScheduleResource.phpindex 88cf4f15..311118d5 100644--- a/app/Http/Resources/Pulse/ScheduleResource.php+++ b/app/Http/Resources/Pulse/ScheduleResource.php@@ -30,7 +30,7 @@ class ScheduleResource extends PulseResource {$timezone = new DateTimeZone(config('app.timezone')); // @phpstan-ignore-linereturn collect($schedule->events())- ->map(fn (Event $event): array => [+ ->map(fn(Event $event): array => ['command' => $this->getCommand($event),'expression' => $this->getExpression($event),'next_due' => $this->getNextDueDateForEvent($event, $timezone)diff --git a/app/Traits/HasPeriod.php b/app/Traits/HasPeriod.phpindex a1137669..2aca87c0 100644--- a/app/Traits/HasPeriod.php+++ b/app/Traits/HasPeriod.php@@ -22,26 +22,14 @@ trait HasPeriod {// Extract the value and unit from the period string[$fullMatch, $value, $unit] = $matches;- // Dynamically create the CarbonInterval based on the unit- switch ($unit) {- case 'hour':- case 'hours':- $result = CarbonInterval::hours($value);- case 'day':- case 'days':- $result = CarbonInterval::hours($value * 24);- case 'week':- case 'weeks':- $result = CarbonInterval::hours($value * 24 * 7);- case 'month':- case 'months':- $result = CarbonInterval::hours($value * 24 * 30);- case 'year':- case 'years':- $result = CarbonInterval::hours($value * 24 * 365);- default:- $result = CarbonInterval::hours(1);- }+ $result = match ($unit) {+ 'hour', 'hours' => CarbonInterval::hours($value),+ 'day', 'days' => CarbonInterval::days($value),+ 'week', 'weeks' => CarbonInterval::weeks($value),+ 'month', 'months' => CarbonInterval::months($value),+ 'year', 'years' => CarbonInterval::years($value),+ default => CarbonInterval::hours(1),+ };return $result;}