ldc-boutique-cnc-sable/domain/Models/ValueObjects/OrderEmployee.php

28 lines
765 B
PHP
Raw Normal View History

2026-06-14 21:32:07 +02:00
<?php
declare(strict_types=1);
namespace Domain\Models\ValueObjects;
final readonly class OrderEmployee
{
public function __construct(
public readonly Matricule $matricule,
public readonly string $firstname,
public readonly string $lastname,
public readonly ShopperEstablishmentCode $facility,
public readonly ShopperSiteCode $site,
public readonly ShopperServiceCode $service,
2026-06-14 21:32:07 +02:00
) {
$this->assertNotEmpty('firstname', $firstname);
$this->assertNotEmpty('lastname', $lastname);
}
private function assertNotEmpty(string $attribute, string $value): void
{
if (empty(trim($value))) {
throw new \DomainException("{$attribute} cannot be empty");
}
}
}