jobs->find([$jobId])[$jobId] ?? null; if ($job === null || $job->mode !== BillingMode::MonthlyFee) { return null; } $billed = $this->queries->billedMonthsOf($jobId); $currentMonth = $this->clock->today()->format('Y-m'); $unbilled = $job->billingStartsOn === '' ? [] : BillingMonths::unbilled($job->billingStartsOn, $job->billingEndsOn, $currentMonth, array_map(fn (BilledMonth $month): string => $month->month, $billed)); return new MonthlyBillingView($job, $billed, $unbilled, $currentMonth, $job->billingEndsOn); } }