Documentation

RDateIterator
in package
implements Iterator

RRuleParser.

This class receives an RRULE string, and allows you to iterate to get a list of dates in that recurrence.

For instance, passing: FREQ=DAILY;LIMIT=5 will cause the iterator to contain 5 items, one for each day.

Tags
copyright

Copyright (C) fruux GmbH (https://fruux.com/)

author

Evert Pot (http://evertpot.com/)

license

http://sabre.io/license/ Modified BSD License

Interfaces, Classes and Traits

Iterator

Table of Contents

$counter  : int
The current item in the list.
$currentDate  : DateTimeInterface
The date of the current iteration. You can get this by calling ->current().
$dates  : array<string|int, mixed>
Array with the RRULE dates.
$startDate  : DateTimeInterface
The reference start date/time for the rrule.
__construct()  : mixed
Creates the Iterator.
current()  : mixed
fastForward()  : mixed
This method allows you to quickly go to the next occurrence after the specified date.
isInfinite()  : bool
Returns true if this recurring event never ends.
key()  : int
Returns the current item number.
next()  : mixed
Goes on to the next iteration.
rewind()  : mixed
Resets the iterator.
valid()  : bool
Returns whether the current item is a valid item for the recurrence iterator.
parseRDate()  : mixed
This method receives a string from an RRULE property, and populates this class with all the values.

Properties

$counter

The current item in the list.

protected int $counter = 0

You can get this number with the key() method.

$currentDate

The date of the current iteration. You can get this by calling ->current().

protected DateTimeInterface $currentDate

$dates

Array with the RRULE dates.

protected array<string|int, mixed> $dates = []

$startDate

The reference start date/time for the rrule.

protected DateTimeInterface $startDate

All calculations are based on this initial date.

Methods

__construct()

Creates the Iterator.

public __construct(string|array<string|int, mixed> $rrule, DateTimeInterface $start) : mixed
Parameters
$rrule : string|array<string|int, mixed>
$start : DateTimeInterface
Return values
mixed

fastForward()

This method allows you to quickly go to the next occurrence after the specified date.

public fastForward(DateTimeInterface $dt) : mixed
Parameters
$dt : DateTimeInterface
Return values
mixed

isInfinite()

Returns true if this recurring event never ends.

public isInfinite() : bool
Return values
bool

key()

Returns the current item number.

public key() : int
Return values
int

next()

Goes on to the next iteration.

public next() : mixed
Return values
mixed

rewind()

Resets the iterator.

public rewind() : mixed
Return values
mixed

valid()

Returns whether the current item is a valid item for the recurrence iterator.

public valid() : bool
Return values
bool

parseRDate()

This method receives a string from an RRULE property, and populates this class with all the values.

protected parseRDate(mixed $rdate) : mixed
Parameters
$rdate : mixed
Return values
mixed

Search results