startTime; } public function getEndTime(): ?string { return $this->endTime; } public function hasTimeRange(): bool { return !empty($this->startTime) && !empty($this->endTime); } /** * 获取时间范围数组 */ public function getTimeRange(): array { return [ 'start' => $this->startTime, 'end' => $this->endTime, ]; } /** * 验证时间范围是否有效 */ public function isValidTimeRange(): bool { if (!$this->hasTimeRange()) { return false; } $start = strtotime($this->startTime); $end = strtotime($this->endTime); return $start && $end && $start <= $end; } }