parseDate(Configuration::getConfigValueByKey('fall_semester_start')); } public function getSpringStart(): ?DateTimeImmutable { return $this->parseDate(Configuration::getConfigValueByKey('spring_semester_start')); } public function getLastSchoolDay(): ?DateTimeImmutable { $value = Configuration::getConfigValueByKey('last_school_day') ?? Configuration::getConfigValueByKey('last_day_of_school'); return $this->parseDate($value); } private function parseDate(?string $value): ?DateTimeImmutable { $value = (string) ($value ?? ''); if ($value === '') { return null; } try { return new DateTimeImmutable($value); } catch (\Throwable) { return null; } } }