2
2
3
3
namespace Sabre \VObject \Recur ;
4
4
5
- use DateTimeImmutable ;
6
5
use DateTimeInterface ;
7
6
use Iterator ;
8
7
use Sabre \VObject \DateTimeParser ;
@@ -85,26 +84,27 @@ public function rewind()
85
84
86
85
/**
87
86
* Goes on to the next iteration.
87
+ *
88
88
* @param int $amount
89
89
*/
90
90
public function next ($ amount = 1 )
91
91
{
92
92
// Otherwise, we find the next event in the normal RRULE
93
93
// sequence.
94
94
switch ($ this ->frequency ) {
95
- case 'hourly ' :
95
+ case 'hourly ' :
96
96
$ this ->nextHourly ($ amount );
97
97
break ;
98
- case 'daily ' :
98
+ case 'daily ' :
99
99
$ this ->nextDaily ($ amount );
100
100
break ;
101
- case 'weekly ' :
101
+ case 'weekly ' :
102
102
$ this ->nextWeekly ($ amount );
103
103
break ;
104
- case 'monthly ' :
104
+ case 'monthly ' :
105
105
$ this ->nextMonthly ($ amount );
106
106
break ;
107
- case 'yearly ' :
107
+ case 'yearly ' :
108
108
$ this ->nextYearly ($ amount );
109
109
break ;
110
110
}
@@ -135,19 +135,19 @@ public function fastForward(DateTimeInterface $dt)
135
135
do {
136
136
$ diff = $ this ->currentDate ->diff ($ dt );
137
137
switch ($ this ->frequency ) {
138
- case 'hourly ' :
138
+ case 'hourly ' :
139
139
$ i = $ diff ->days * 24 ;
140
140
break ;
141
- case 'daily ' :
141
+ case 'daily ' :
142
142
$ i = $ diff ->days ;
143
143
break ;
144
- case 'weekly ' :
144
+ case 'weekly ' :
145
145
$ i = $ diff ->days / 7 ;
146
146
break ;
147
- case 'monthly ' :
147
+ case 'monthly ' :
148
148
$ i = $ diff ->days / 30 ;
149
149
break ;
150
- case 'yearly ' :
150
+ case 'yearly ' :
151
151
$ i = $ diff ->days / 365 ;
152
152
break ;
153
153
}
@@ -355,6 +355,7 @@ protected function nextDaily($amount = 1)
355
355
{
356
356
if (!$ this ->byHour && !$ this ->byDay ) {
357
357
$ this ->currentDate = $ this ->currentDate ->modify ('+ ' .$ amount * $ this ->interval .' days ' );
358
+
358
359
return ;
359
360
}
360
361
@@ -384,7 +385,6 @@ protected function nextDaily($amount = 1)
384
385
$ amount = 1 ;
385
386
}
386
387
387
-
388
388
// Current month of the year
389
389
$ currentMonth = $ this ->currentDate ->format ('n ' );
390
390
@@ -403,10 +403,11 @@ protected function nextDaily($amount = 1)
403
403
/**
404
404
* Does the processing for advancing the iterator for weekly frequency.
405
405
*/
406
- protected function nextWeekly ($ amount = 1 ) {
407
-
406
+ protected function nextWeekly ($ amount = 1 )
407
+ {
408
408
if (!$ this ->byHour && !$ this ->byDay ) {
409
- $ this ->currentDate = $ this ->currentDate ->modify ('+ ' .($ amount * $ this ->interval ).' weeks ' );
409
+ $ this ->currentDate = $ this ->currentDate ->modify ('+ ' .($ amount * $ this ->interval ).' weeks ' );
410
+
410
411
return ;
411
412
}
412
413
@@ -435,7 +436,7 @@ protected function nextWeekly($amount = 1) {
435
436
$ currentHour = (int ) $ this ->currentDate ->format ('G ' );
436
437
437
438
// We need to roll over to the next week
438
- if ($ currentDay === $ firstDay && (!$ this ->byHour || $ currentHour == ' 0 ' )) {
439
+ if ($ currentDay === $ firstDay && (!$ this ->byHour || ' 0 ' == $ currentHour )) {
439
440
$ this ->currentDate = $ this ->currentDate ->modify ('+ ' .(($ amount * $ this ->interval ) - 1 ).' weeks ' );
440
441
$ amount = 1 ;
441
442
// We need to go to the first day of this week, but only if we
0 commit comments