-
Notifications
You must be signed in to change notification settings - Fork 130
Sabre VObject Recur EventIterator
This class is used to determine new for a recurring event, when the next events occur.
This iterator may loop infinitely in the future, therefore it is important that if you use this class, you set hard limits for the amount of iterations you want to handle.
Note that currently there is not full support for the entire iCalendar specification, as it's very complex and contains a lot of permutations that's not yet used very often in software.
For the focus has been on features as they actually appear in Calendaring software, but this may well get expanded as needed / on demand
The following RRULE properties are supported
- UNTIL
- INTERVAL
- COUNT
- FREQ=DAILY
- BYDAY
- BYHOUR
- BYMONTH
- FREQ=WEEKLY
- BYDAY
- BYHOUR
- WKST
- FREQ=MONTHLY
- BYMONTHDAY
- BYDAY
- BYSETPOS
- FREQ=YEARLY
- BYMONTH
- BYMONTHDAY (only if BYMONTH is also set)
- BYDAY (only if BYMONTH is also set)
Anything beyond this is 'undefined', which means that it may get ignored, or you may get unexpected results. The effect is that in some applications the specified recurrence may look incorrect, or is missing.
The recurrence iterator also does not yet support THISANDFUTURE.
- Class name: EventIterator
- Namespace: Sabre\VObject\Recur
- This class implements: Iterator
protected \Sabre\VObject\Recur\RRuleIterator $recurIterator
RRULE parser
- Visibility: protected
protected mixed $eventDuration
The duration, in seconds, of the master event.
We use this to calculate the DTEND for subsequent events.
- Visibility: protected
protected \Sabre\VObject\Recur\VEVENT $masterEvent
A reference to the main (master) event.
- Visibility: protected
protected array $overriddenEvents = array()
List of overridden events.
- Visibility: protected
protected array $overriddenEventsIndex
Overridden event index.
Key is timestamp, value is the index of the item in the $overriddenEvent property.
- Visibility: protected
protected array $exceptions = array()
A list of recurrence-id's that are either part of EXDATE, or are overridden.
- Visibility: protected
protected integer $counter
Internal event counter
- Visibility: protected
protected \DateTime $startDate
The very start of the iteration process.
- Visibility: protected
protected \DateTime $currentDate
Where we are currently in the iteration process
- Visibility: protected
protected \DateTime $nextDate
The next date from the rrule parser.
Sometimes we need to temporary store the next date, because an overridden event came before.
- Visibility: protected
mixed Sabre\VObject\Recur\EventIterator::__construct(\Sabre\VObject\Component $vcal, string|null $uid)
Creates the iterator
You should pass a VCALENDAR component, as well as the UID of the event we're going to traverse.
- Visibility: public
- $vcal Sabre\VObject\Component
- $uid string|null
\DateTime Sabre\VObject\Recur\EventIterator::current()
Returns the date for the current position of the iterator.
- Visibility: public
\DateTime Sabre\VObject\Recur\EventIterator::getDtStart()
This method returns the start date for the current iteration of the event.
- Visibility: public
\DateTime Sabre\VObject\Recur\EventIterator::getDtEnd()
This method returns the end date for the current iteration of the event.
- Visibility: public
\Sabre\VObject\Component\VEvent Sabre\VObject\Recur\EventIterator::getEventObject()
Returns a VEVENT for the current iterations of the event.
This VEVENT will have a recurrence id, and it's DTSTART and DTEND altered.
- Visibility: public
integer Sabre\VObject\Recur\EventIterator::key()
Returns the current position of the iterator.
This is for us simply a 0-based index.
- Visibility: public
boolean Sabre\VObject\Recur\EventIterator::valid()
This is called after next, to see if the iterator is still at a valid position, or if it's at the end.
- Visibility: public
mixed Sabre\VObject\Recur\EventIterator::rewind()
Sets the iterator back to the starting point.
- Visibility: public
void Sabre\VObject\Recur\EventIterator::next()
Advances the iterator with one step.
- Visibility: public
mixed Sabre\VObject\Recur\EventIterator::fastForward(\DateTime $dateTime)
Quickly jump to a date in the future.
- Visibility: public
- $dateTime DateTime
boolean Sabre\VObject\Recur\EventIterator::isInfinite()
Returns true if this recurring event never ends.
- Visibility: public