The quarters marked billed, keyed by work type id. */ public function execute(int $jobId, int $billingExportId): array { return $this->transactions->run(function () use ($jobId, $billingExportId): array { $quarters = []; foreach ($this->entries->approvedUnbilledForJob($jobId) as $entry) { $entry->markBilled($billingExportId); $this->entries->save($entry); $quarters[$entry->workTypeId()] = ($quarters[$entry->workTypeId()] ?? 0) + $entry->hours()->quarters; } return $quarters; }); } }