frequency; } public function interval(): int { return $this->interval; } public function concludes(): DateTime | null { // evaluate if until value is a date if ($this->until instanceof DateTimeInterface) { return DateTime::createFromInterface($this->until); } // evaluate if count value is higher than 0 if ($this->count > 0) { // temporarily store current recurrence date and counter $currentReccuranceDate = $this->currentDate; $currentCounter = $this->counter; // iterate over occurrences until last one (subtract 2 from count for start and end occurrence) while ($this->counter <= ($this->count - 2)) { $this->next(); } // temporarly store last reccurance date $lastReccuranceDate = $this->currentDate; // restore current recurrence date and counter $this->currentDate = $currentReccuranceDate; $this->counter = $currentCounter; // return last recurrence date return DateTime::createFromInterface($lastReccuranceDate); } return null; } public function concludesAfter(): int | null { return !empty($this->count) ? $this->count : null; } public function concludesOn(): DateTime | null { return isset($this->until) ? DateTime::createFromInterface($this->until) : null; } public function daysOfWeek(): array { return $this->byDay; } public function daysOfMonth(): array { return $this->byMonthDay; } public function daysOfYear(): array { return $this->byYearDay; } public function weeksOfYear(): array { return $this->byWeekNo; } public function monthsOfYear(): array { return $this->byMonth; } public function isRelative(): bool { return isset($this->bySetPos); } public function relativePosition(): array { return $this->bySetPos; } }