Skip to content

Sabre VObject Recur EventIterator

Evert Pot edited this page Sep 1, 2014 · 3 revisions

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

Properties

$recurIterator

protected \Sabre\VObject\Recur\RRuleIterator $recurIterator

RRULE parser

  • Visibility: protected

$eventDuration

protected mixed $eventDuration

The duration, in seconds, of the master event.

We use this to calculate the DTEND for subsequent events.

  • Visibility: protected

$masterEvent

protected \Sabre\VObject\Recur\VEVENT $masterEvent

A reference to the main (master) event.

  • Visibility: protected

$overriddenEvents

protected array $overriddenEvents = array()

List of overridden events.

  • Visibility: protected

$overriddenEventsIndex

protected array $overriddenEventsIndex

Overridden event index.

Key is timestamp, value is the index of the item in the $overriddenEvent property.

  • Visibility: protected

$exceptions

protected array $exceptions = array()

A list of recurrence-id's that are either part of EXDATE, or are overridden.

  • Visibility: protected

$counter

protected integer $counter

Internal event counter

  • Visibility: protected

$startDate

protected \DateTime $startDate

The very start of the iteration process.

  • Visibility: protected

$currentDate

protected \DateTime $currentDate

Where we are currently in the iteration process

  • Visibility: protected

$nextDate

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

Methods

__construct

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

Arguments

current

\DateTime Sabre\VObject\Recur\EventIterator::current()

Returns the date for the current position of the iterator.

  • Visibility: public

getDtStart

\DateTime Sabre\VObject\Recur\EventIterator::getDtStart()

This method returns the start date for the current iteration of the event.

  • Visibility: public

getDtEnd

\DateTime Sabre\VObject\Recur\EventIterator::getDtEnd()

This method returns the end date for the current iteration of the event.

  • Visibility: public

getEventObject

\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

key

integer Sabre\VObject\Recur\EventIterator::key()

Returns the current position of the iterator.

This is for us simply a 0-based index.

  • Visibility: public

valid

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

rewind

mixed Sabre\VObject\Recur\EventIterator::rewind()

Sets the iterator back to the starting point.

  • Visibility: public

next

void Sabre\VObject\Recur\EventIterator::next()

Advances the iterator with one step.

  • Visibility: public

fastForward

mixed Sabre\VObject\Recur\EventIterator::fastForward(\DateTime $dateTime)

Quickly jump to a date in the future.

  • Visibility: public

Arguments

  • $dateTime DateTime

isInfinite

boolean Sabre\VObject\Recur\EventIterator::isInfinite()

Returns true if this recurring event never ends.

  • Visibility: public
Clone this wiki locally