ldc-cocotte/app/Services/ArcadiaEmployee.php

32 lines
984 B
PHP
Raw Permalink Normal View History

<?php
declare(strict_types=1);
namespace App\Services;
use Domain\Models\ValueObjects\Matricule;
use Domain\Models\ValueObjects\ShopperEstablishmentCode;
use Domain\Models\ValueObjects\ShopperServiceCode;
use Domain\Models\ValueObjects\ShopperSiteCode;
final readonly class ArcadiaEmployee
{
public function __construct(
public readonly Matricule $matricule,
public readonly string $lastname,
public readonly string $firstname,
public readonly \DateTimeInterface $startDate,
public readonly ?\DateTimeInterface $endDate,
public readonly ShopperEstablishmentCode $etablissement,
public readonly ShopperSiteCode $site,
public readonly ShopperServiceCode $service
) {
if (trim($lastname) === '') {
throw new \UnexpectedValueException('nom cannot be empty');
}
if (trim($firstname) === '') {
throw new \DomainException('prenom cannot be empty');
}
}
}