PHP Class Sabre\VObject\Recur\EventIterator

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.
Author: Evert Pot (http://evertpot.com/)
Inheritance: implements Iterator
Mostrar archivo Open project: horde/horde Class Usage Examples

Protected Properties

Property Type Description
$allDay boolean True if we're iterating an all-day event.
$counter integer Internal event counter
$currentDate DateTime Where we are currently in the iteration process
$eventDuration We use this to calculate the DTEND for subsequent events.
$exceptions array A list of recurrence-id's that are either part of EXDATE, or are overridden.
$masterEvent VEVENT A reference to the main (master) event.
$nextDate DateTime Sometimes we need to temporary store the next date, because an overridden event came before.
$overriddenEvents array List of overridden events.
$overriddenEventsIndex array Key is timestamp, value is the index of the item in the $overriddenEvent property.
$recurIterator Sabre\VObject\Recur\RRuleIterator RRULE parser
$startDate DateTime The very start of the iteration process.
$timeZone DateTimeZone Reference timeZone for floating dates and times.

Public Methods

Method Description
__construct ( Sabre\VObject\Component | array $input, string | null $uid = null, DateTimeZone $timeZone = null ) Creates the iterator
current ( ) : DateTime Returns the date for the current position of the iterator.
fastForward ( DateTime $dateTime ) Quickly jump to a date in the future.
getDtEnd ( ) : DateTime This method returns the end date for the current iteration of the event.
getDtStart ( ) : DateTime This method returns the start date for the current iteration of the event.
getEventObject ( ) : Sabre\VObject\Component\VEvent Returns a VEVENT for the current iterations of the event.
isInfinite ( ) : boolean Returns true if this recurring event never ends.
key ( ) : integer Returns the current position of the iterator.
next ( ) : void Advances the iterator with one step.
rewind ( ) Sets the iterator back to the starting point.
valid ( ) : boolean This is called after next, to see if the iterator is still at a valid position, or if it's at the end.

Method Details

__construct() public method

There's three ways to set up the iterator. 1. You can pass a VCALENDAR component and a UID. 2. You can pass an array of VEVENTs (all UIDS should match). 3. You can pass a single VEVENT component. Only the second method is recomended. The other 1 and 3 will be removed at some point in the future. The $uid parameter is only required for the first method.
public __construct ( Sabre\VObject\Component | array $input, string | null $uid = null, DateTimeZone $timeZone = null )
$input Sabre\VObject\Component | array
$uid string | null
$timeZone DateTimeZone Reference timezone for floating dates and times.

current() public method

Returns the date for the current position of the iterator.
public current ( ) : DateTime
return DateTime

fastForward() public method

Quickly jump to a date in the future.
public fastForward ( DateTime $dateTime )
$dateTime DateTime

getDtEnd() public method

This method returns the end date for the current iteration of the event.
public getDtEnd ( ) : DateTime
return DateTime

getDtStart() public method

This method returns the start date for the current iteration of the event.
public getDtStart ( ) : DateTime
return DateTime

getEventObject() public method

This VEVENT will have a recurrence id, and it's DTSTART and DTEND altered.
public getEventObject ( ) : Sabre\VObject\Component\VEvent
return Sabre\VObject\Component\VEvent

isInfinite() public method

Returns true if this recurring event never ends.
public isInfinite ( ) : boolean
return boolean

key() public method

This is for us simply a 0-based index.
public key ( ) : integer
return integer

next() public method

Advances the iterator with one step.
public next ( ) : void
return void

rewind() public method

Sets the iterator back to the starting point.
public rewind ( )

valid() public method

This is called after next, to see if the iterator is still at a valid position, or if it's at the end.
public valid ( ) : boolean
return boolean

Property Details

$allDay protected_oe property

True if we're iterating an all-day event.
protected bool $allDay
return boolean

$counter protected_oe property

Internal event counter
protected int $counter
return integer

$currentDate protected_oe property

Where we are currently in the iteration process
protected DateTime $currentDate
return DateTime

$eventDuration protected_oe property

We use this to calculate the DTEND for subsequent events.
protected $eventDuration

$exceptions protected_oe property

A list of recurrence-id's that are either part of EXDATE, or are overridden.
protected array $exceptions
return array

$masterEvent protected_oe property

A reference to the main (master) event.
protected VEVENT $masterEvent
return VEVENT

$nextDate protected_oe property

Sometimes we need to temporary store the next date, because an overridden event came before.
protected DateTime $nextDate
return DateTime

$overriddenEvents protected_oe property

List of overridden events.
protected array $overriddenEvents
return array

$overriddenEventsIndex protected_oe property

Key is timestamp, value is the index of the item in the $overriddenEvent property.
protected array $overriddenEventsIndex
return array

$recurIterator protected_oe property

RRULE parser
protected RRuleIterator,Sabre\VObject\Recur $recurIterator
return Sabre\VObject\Recur\RRuleIterator

$startDate protected_oe property

The very start of the iteration process.
protected DateTime $startDate
return DateTime

$timeZone protected_oe property

Reference timeZone for floating dates and times.
protected DateTimeZone $timeZone
return DateTimeZone