27 lines
605 B
PHP
27 lines
605 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Modules\TimeTracking\Application\DTOs;
|
|
|
|
/**
|
|
* A customer on the time sheet (level 1), in its own colour, with its jobs.
|
|
*/
|
|
final readonly class TimesheetCustomerGroup
|
|
{
|
|
/**
|
|
* @param list<TimesheetJobGroup> $jobs
|
|
*/
|
|
public function __construct(
|
|
public int $customerId,
|
|
public string $name,
|
|
public ?string $headerColor,
|
|
public array $jobs,
|
|
) {}
|
|
|
|
public function taskCount(): int
|
|
{
|
|
return array_sum(array_map(fn (TimesheetJobGroup $job): int => count($job->rows), $this->jobs));
|
|
}
|
|
}
|