$billed Oldest first. * @param list $unbilled Y-m, oldest first, up to the current month. * @param string|null $billingEndsOn Y-m-d: the job's last day or completion day, after which nothing is billed. */ public function __construct( public BillableJob $job, public array $billed, public array $unbilled, public string $currentMonth, public ?string $billingEndsOn, ) {} public function billedNetCents(): int { return array_sum(array_map(fn (BilledMonth $month): int => $month->netCents, $this->billed)); } }