expenses->unbilledBillable($jobIds) as $expense) { $result[$expense->job->id][] = new BillableExpense($expense->id, $expense->job->id, $this->description($expense), (int) $expense->billedAmountCents); } return $result; } public function markBilled(int $jobId, int $billingExportId): array { return $this->markBilled->execute($jobId, $billingExportId); } private function description(ExpenseSummary $expense): string { $what = $expense->category === ExpenseCategory::Mileage && $expense->kilometerTenths !== null ? __('expenses.mileage_summary', [ 'km' => (new Kilometers($expense->kilometerTenths))->format(), 'destination' => $expense->destination, 'purpose' => $expense->purpose, ]) : (string) $expense->description; return __('billing.expense_line', [ 'category' => __('expenses.categories.'.$expense->category->value), 'day' => CarbonImmutable::parse($expense->spentOn)->format('j.n.Y'), 'what' => $what, ]); } }