Support concurrency of multiple RDATE together with RRULE directives.
This PR address #347 and its duplicate #700. The commit also adds a test. The idea is to maintain an array of iterators, compare their current values and pick the smallest one in next(). Then all iterators matching the timestamp value of the chosen DateTime are advanced, which the others which may be invalid or have their individual current values still ahead of time are kept at their position.
I have added a test (with one RRULE and RDATES which are placed "out of order").
Actually, the changes to the RDateIterator.php would not be needed; I started with the PHP AppendIterator, but as this was not enough: duplicated event dates are handled by the EventIterator anyway, which now behaves like an "OrderedUniqueAppendIterator".
Actually, the changes to the
RDateIterator.phpwould not be needed; I started with the PHP AppendIterator, but as this was not enough: duplicated event dates are handled by the EventIterator anyway, which now behaves like an "OrderedUniqueAppendIterator".
Nope, it ain't that easy. However, this is also due to the current code base. If the current event DTSTART refers to a date after the dates defined by an RDATE rule, then the ordering of the values returned by the current EventIterator is garbled: it will always return the DTSTART value of the master event as first item which is wrong. RDATE exception may very well refer to events which are in the past w.r.t. DTSTART of the master event.
This also means that further changes would be needed. The RDate iterator has to take care of this.