ldc-mesbr-app/src/Domain/Models/ValueObjects/Period.php
2026-10-02 12:48:00 +02:00

19 lines
371 B
PHP

<?php
declare(strict_types=1);
namespace Domain\Models\ValueObjects;
use DateTime;
final readonly class Period
{
public function __construct(
public DateTime $start,
public DateTime $end,
) {
if ($this->end < $this->start) {
throw new \DomainException('Period end date cannot be before its start date.');
}
}
}