*/ final readonly class Shopper implements Entity { public function __construct( private readonly ShopperId $id, public readonly Email $email, public readonly Matricule $matricule, public readonly string $nom, public readonly string $prenom, public readonly CarbonInterface $startDate, public readonly ?CarbonInterface $endDate, public readonly ShopperEstablishmentCode $etablissement, public readonly ShopperSiteCode $site, public readonly ShopperServiceCode $service ) { if (trim($nom) === '') { throw new \DomainException('nom cannot be empty'); } if (trim($prenom) === '') { throw new \DomainException('prenom cannot be empty'); } } #[\Override] public function id(): ShopperId { return $this->id; } public function isActive(): bool { return $this->endDate === null || $this->endDate->greaterThan(CarbonImmutable::now()); } }