public function __construct(DateTime $startDate, DateTime $endDate) { if ($startDate > $endDate) { throw InvalidPeriod::startDateCannotBeAfterEndDate($startDate, $endDate); } $this->startDate = $startDate; $this->endDate = $endDate; }