|
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;
|
@@ -92,19 +91,19 @@ public function next($amount = 1)
|
92 | 91 | // Otherwise, we find the next event in the normal RRULE
|
93 | 92 | // sequence.
|
94 | 93 | switch ($this->frequency) {
|
95 |
| - case 'hourly' : |
| 94 | + case 'hourly': |
96 | 95 | $this->nextHourly($amount);
|
97 | 96 | break;
|
98 |
| - case 'daily' : |
| 97 | + case 'daily': |
99 | 98 | $this->nextDaily($amount);
|
100 | 99 | break;
|
101 |
| - case 'weekly' : |
| 100 | + case 'weekly': |
102 | 101 | $this->nextWeekly($amount);
|
103 | 102 | break;
|
104 |
| - case 'monthly' : |
| 103 | + case 'monthly': |
105 | 104 | $this->nextMonthly($amount);
|
106 | 105 | break;
|
107 |
| - case 'yearly' : |
| 106 | + case 'yearly': |
108 | 107 | $this->nextYearly($amount);
|
109 | 108 | break;
|
110 | 109 | }
|
@@ -135,19 +134,19 @@ public function fastForward(DateTimeInterface $dt)
|
135 | 134 | do {
|
136 | 135 | $diff = $this->currentDate->diff($dt);
|
137 | 136 | switch ($this->frequency) {
|
138 |
| - case 'hourly' : |
| 137 | + case 'hourly': |
139 | 138 | $i = $diff->days * 24;
|
140 | 139 | break;
|
141 |
| - case 'daily' : |
| 140 | + case 'daily': |
142 | 141 | $i = $diff->days;
|
143 | 142 | break;
|
144 |
| - case 'weekly' : |
| 143 | + case 'weekly': |
145 | 144 | $i = $diff->days / 7;
|
146 | 145 | break;
|
147 |
| - case 'monthly' : |
| 146 | + case 'monthly': |
148 | 147 | $i = $diff->days / 30;
|
149 | 148 | break;
|
150 |
| - case 'yearly' : |
| 149 | + case 'yearly': |
151 | 150 | $i = $diff->days / 365;
|
152 | 151 | break;
|
153 | 152 | }
|
@@ -403,10 +402,11 @@ protected function nextDaily($amount = 1)
|
403 | 402 | /**
|
404 | 403 | * Does the processing for advancing the iterator for weekly frequency.
|
405 | 404 | */
|
406 |
| - protected function nextWeekly($amount = 1) { |
| 405 | + protected function nextWeekly($amount = 1) |
| 406 | + { |
407 | 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 | return;
|
411 | 411 | }
|
412 | 412 |
|
@@ -435,7 +435,7 @@ protected function nextWeekly($amount = 1) {
|
435 | 435 | $currentHour = (int) $this->currentDate->format('G');
|
436 | 436 |
|
437 | 437 | // We need to roll over to the next week
|
438 |
| - if ($currentDay === $firstDay && (!$this->byHour || $currentHour == '0')) { |
| 438 | + if ($currentDay === $firstDay && (!$this->byHour || '0' == $currentHour)) { |
439 | 439 | $this->currentDate = $this->currentDate->modify('+'.(($amount * $this->interval) - 1).' weeks');
|
440 | 440 | $amount = 1;
|
441 | 441 | // We need to go to the first day of this week, but only if we
|
@@ -596,7 +596,6 @@ protected function nextYearly($amount = 1)
|
596 | 596 |
|
597 | 597 | if (count($checkDates) > 0) {
|
598 | 598 | $this->currentDate = min($checkDates);
|
599 |
| - |
600 | 599 | return;
|
601 | 600 | }
|
602 | 601 |
|
|
0 commit comments