ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Sabre\VObject\Recur\RDateIterator Class Reference

RRuleParser. More...

+ Inheritance diagram for Sabre\VObject\Recur\RDateIterator:
+ Collaboration diagram for Sabre\VObject\Recur\RDateIterator:

Public Member Functions

 __construct ($rrule, DateTimeInterface $start)
 Creates the Iterator. More...
 
 current ()
 
 key ()
 Returns the current item number. More...
 
 valid ()
 Returns whether the current item is a valid item for the recurrence iterator. More...
 
 rewind ()
 Resets the iterator. More...
 
 next ()
 Goes on to the next iteration. More...
 
 isInfinite ()
 Returns true if this recurring event never ends. More...
 
 fastForward (DateTimeInterface $dt)
 This method allows you to quickly go to the next occurrence after the specified date. More...
 

Protected Member Functions

 parseRDate ($rdate)
 This method receives a string from an RRULE property, and populates this class with all the values. More...
 

Protected Attributes

 $startDate
 
 $currentDate
 
 $counter = 0
 
 $dates = []
 

Detailed Description

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.

Author
Evert Pot (http://evertpot.com/) @license http://sabre.io/license/ Modified BSD License

Definition at line 22 of file RDateIterator.php.

Constructor & Destructor Documentation

◆ __construct()

Sabre\VObject\Recur\RDateIterator::__construct (   $rrule,
DateTimeInterface  $start 
)

Creates the Iterator.

Parameters
string | array$rrule
DateTimeInterface$start

Definition at line 30 of file RDateIterator.php.

30 {
31
32 $this->startDate = $start;
33 $this->parseRDate($rrule);
34 $this->currentDate = clone $this->startDate;
35
36 }
parseRDate($rdate)
This method receives a string from an RRULE property, and populates this class with all the values.
$start
Definition: bench.php:8

References $start, Sabre\VObject\Recur\RDateIterator\$startDate, and Sabre\VObject\Recur\RDateIterator\parseRDate().

+ Here is the call graph for this function:

Member Function Documentation

◆ current()

Sabre\VObject\Recur\RDateIterator::current ( )

Definition at line 40 of file RDateIterator.php.

40 {
41
42 if (!$this->valid()) return;
43 return clone $this->currentDate;
44
45 }
valid()
Returns whether the current item is a valid item for the recurrence iterator.

References Sabre\VObject\Recur\RDateIterator\$currentDate, and Sabre\VObject\Recur\RDateIterator\valid().

+ Here is the call graph for this function:

◆ fastForward()

Sabre\VObject\Recur\RDateIterator::fastForward ( DateTimeInterface  $dt)

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

Parameters
DateTimeInterface$dt
Returns
void

Definition at line 121 of file RDateIterator.php.

121 {
122
123 while ($this->valid() && $this->currentDate < $dt) {
124 $this->next();
125 }
126
127 }
next()
Goes on to the next iteration.

References Sabre\VObject\Recur\RDateIterator\next(), and Sabre\VObject\Recur\RDateIterator\valid().

+ Here is the call graph for this function:

◆ isInfinite()

Sabre\VObject\Recur\RDateIterator::isInfinite ( )

Returns true if this recurring event never ends.

Returns
bool

Definition at line 107 of file RDateIterator.php.

107 {
108
109 return false;
110
111 }

◆ key()

Sabre\VObject\Recur\RDateIterator::key ( )

Returns the current item number.

Returns
int

Definition at line 52 of file RDateIterator.php.

References Sabre\VObject\Recur\RDateIterator\$counter.

◆ next()

Sabre\VObject\Recur\RDateIterator::next ( )

Goes on to the next iteration.

Returns
void

Definition at line 87 of file RDateIterator.php.

87 {
88
89 $this->counter++;
90 if (!$this->valid()) return;
91
92 $this->currentDate =
94 $this->dates[$this->counter - 1],
95 $this->startDate->getTimezone()
96 );
97
98 }
static parse($date, $referenceTz=null)
Parses either a Date or DateTime, or Duration value.

References Sabre\VObject\DateTimeParser\parse(), and Sabre\VObject\Recur\RDateIterator\valid().

Referenced by Sabre\VObject\Recur\RDateIterator\fastForward().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parseRDate()

Sabre\VObject\Recur\RDateIterator::parseRDate (   $rdate)
protected

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

Parameters
string | array$rrule
Returns
void

Definition at line 165 of file RDateIterator.php.

165 {
166
167 if (is_string($rdate)) {
168 $rdate = explode(',', $rdate);
169 }
170
171 $this->dates = $rdate;
172
173 }

Referenced by Sabre\VObject\Recur\RDateIterator\__construct().

+ Here is the caller graph for this function:

◆ rewind()

Sabre\VObject\Recur\RDateIterator::rewind ( )

Resets the iterator.

Returns
void

Definition at line 75 of file RDateIterator.php.

75 {
76
77 $this->currentDate = clone $this->startDate;
78 $this->counter = 0;
79
80 }

References Sabre\VObject\Recur\RDateIterator\$startDate.

◆ valid()

Sabre\VObject\Recur\RDateIterator::valid ( )

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

Returns
bool

Definition at line 64 of file RDateIterator.php.

64 {
65
66 return ($this->counter <= count($this->dates));
67
68 }

Referenced by Sabre\VObject\Recur\RDateIterator\current(), Sabre\VObject\Recur\RDateIterator\fastForward(), and Sabre\VObject\Recur\RDateIterator\next().

+ Here is the caller graph for this function:

Field Documentation

◆ $counter

Sabre\VObject\Recur\RDateIterator::$counter = 0
protected

Definition at line 153 of file RDateIterator.php.

Referenced by Sabre\VObject\Recur\RDateIterator\key().

◆ $currentDate

Sabre\VObject\Recur\RDateIterator::$currentDate
protected

Definition at line 144 of file RDateIterator.php.

Referenced by Sabre\VObject\Recur\RDateIterator\current().

◆ $dates

Sabre\VObject\Recur\RDateIterator::$dates = []
protected

Definition at line 180 of file RDateIterator.php.

◆ $startDate

Sabre\VObject\Recur\RDateIterator::$startDate
protected

The documentation for this class was generated from the following file: