19 lines
371 B
PHP
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.');
|
|
}
|
|
}
|
|
}
|