-
Notifications
You must be signed in to change notification settings - Fork 126
Sabre VObject Recur RRuleIterator
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.
- Class name: RRuleIterator
- Namespace: Sabre\VObject\Recur
- This class implements: Iterator
protected \DateTime $startDate
The reference start date/time for the rrule.
All calculations are based on this initial date.
- Visibility: protected
protected \DateTime $currentDate
The date of the current iteration. You can get this by calling ->current().
- Visibility: protected
protected string $frequency
Frequency is one of: secondly, minutely, hourly, daily, weekly, monthly, yearly.
- Visibility: protected
protected integer $count
The number of recurrences, or 'null' if infinitely recurring.
- Visibility: protected
protected integer $interval = 1
The interval.
If for example frequency is set to daily, interval = 2 would mean every 2 days.
- Visibility: protected
protected \DateTime $until
The last instance of this recurrence, inclusively
- Visibility: protected
protected array $bySecond
Which seconds to recur.
This is an array of integers (between 0 and 60)
- Visibility: protected
protected array $byMinute
Which minutes to recur
This is an array of integers (between 0 and 59)
- Visibility: protected
protected array $byHour
Which hours to recur
This is an array of integers (between 0 and 23)
- Visibility: protected
protected integer $counter
The current item in the list.
You can get this number with the key() method.
- Visibility: protected
protected array $byDay
Which weekdays to recur.
This is an array of weekdays
This may also be preceeded by a positive or negative integer. If present, this indicates the nth occurrence of a specific day within the monthly or yearly rrule. For instance, -2TU indicates the second-last tuesday of the month, or year.
- Visibility: protected
protected array $byMonthDay
Which days of the month to recur
This is an array of days of the months (1-31). The value can also be negative. -5 for instance means the 5th last day of the month.
- Visibility: protected
protected array $byYearDay
Which days of the year to recur.
This is an array with days of the year (1 to 366). The values can also be negative. For instance, -1 will always represent the last day of the year. (December 31st).
- Visibility: protected
protected array $byWeekNo
Which week numbers to recur.
This is an array of integers from 1 to 53. The values can also be negative. -1 will always refer to the last week of the year.
- Visibility: protected
protected array $byMonth
Which months to recur.
This is an array of integers from 1 to 12.
- Visibility: protected
protected array $bySetPos
Which items in an existing st to recur.
These numbers work together with an existing by* rule. It specifies exactly which items of the existing by-rule to filter.
Valid values are 1 to 366 and -1 to -366. As an example, this can be used to recur the last workday of the month.
This would be done by setting frequency to 'monthly', byDay to 'MO,TU,WE,TH,FR' and bySetPos to -1.
- Visibility: protected
protected string $weekStart = 'MO'
When the week starts.
- Visibility: protected
protected array $dayNames = array(0 => 'Sunday', 1 => 'Monday', 2 => 'Tuesday', 3 => 'Wednesday', 4 => 'Thursday', 5 => 'Friday', 6 => 'Saturday')
Mappings between the day number and english day name.
- Visibility: protected
protected array $dayMap = array('SU' => 0, 'MO' => 1, 'TU' => 2, 'WE' => 3, 'TH' => 4, 'FR' => 5, 'SA' => 6)
Simple mapping from iCalendar day names to day numbers
- Visibility: protected
mixed Sabre\VObject\Recur\RRuleIterator::__construct(string|array $rrule, \DateTime $start)
Creates the Iterator
- Visibility: public
- $rrule string|array
- $start DateTime
mixed Sabre\VObject\Recur\RRuleIterator::current()
- Visibility: public
integer Sabre\VObject\Recur\RRuleIterator::key()
Returns the current item number
- Visibility: public
boolean Sabre\VObject\Recur\RRuleIterator::valid()
Returns whether the current item is a valid item for the recurrence iterator. This will return false if we've gone beyond the UNTIL or COUNT statements.
- Visibility: public
void Sabre\VObject\Recur\RRuleIterator::rewind()
Resets the iterator
- Visibility: public
void Sabre\VObject\Recur\RRuleIterator::next()
Goes on to the next iteration
- Visibility: public
boolean Sabre\VObject\Recur\RRuleIterator::isInfinite()
Returns true if this recurring event never ends.
- Visibility: public
void Sabre\VObject\Recur\RRuleIterator::fastForward(\DateTime $dt)
This method allows you to quickly go to the next occurrence after the specified date.
- Visibility: public
- $dt DateTime
void Sabre\VObject\Recur\RRuleIterator::nextHourly()
Does the processing for advancing the iterator for hourly frequency.
- Visibility: protected
void Sabre\VObject\Recur\RRuleIterator::nextDaily()
Does the processing for advancing the iterator for daily frequency.
- Visibility: protected
void Sabre\VObject\Recur\RRuleIterator::nextWeekly()
Does the processing for advancing the iterator for weekly frequency.
- Visibility: protected
void Sabre\VObject\Recur\RRuleIterator::nextMonthly()
Does the processing for advancing the iterator for monthly frequency.
- Visibility: protected
void Sabre\VObject\Recur\RRuleIterator::nextYearly()
Does the processing for advancing the iterator for yearly frequency.
- Visibility: protected
void Sabre\VObject\Recur\RRuleIterator::parseRRule(string|array $rrule)
This method receives a string from an RRULE property, and populates this class with all the values.
- Visibility: protected
- $rrule string|array
array Sabre\VObject\Recur\RRuleIterator::getMonthlyOccurrences()
Returns all the occurrences for a monthly frequency with a 'byDay' or 'byMonthDay' expansion for the current month.
The returned list is an array of integers with the day of month (1-31).
- Visibility: protected
mixed Sabre\VObject\Recur\RRuleIterator::getHours()
- Visibility: protected
mixed Sabre\VObject\Recur\RRuleIterator::getDays()
- Visibility: protected
mixed Sabre\VObject\Recur\RRuleIterator::getMonths()
- Visibility: protected