@@ -6,8 +6,8 @@ discard block |
||
| 6 | 6 | |
| 7 | 7 | private array $schedules = []; |
| 8 | 8 | private array $oneTimeEvents = []; |
| 9 | - private \DateTime|null $startTime = null; |
|
| 10 | - private \DateTime|null $endTime = null; |
|
| 9 | + private \DateTime | null $startTime = null; |
|
| 10 | + private \DateTime | null $endTime = null; |
|
| 11 | 11 | |
| 12 | 12 | /** |
| 13 | 13 | * @return static |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | foreach ($this->schedules as $schedule) { |
| 99 | 99 | $d = new \DateTime($fromDateStr); |
| 100 | 100 | |
| 101 | - for ($i=0, $maxRecursion = 100 * $limit; $i < $limit && $maxRecursion > 0; ++$i, --$maxRecursion) { |
|
| 101 | + for ($i = 0, $maxRecursion = 100 * $limit; $i < $limit && $maxRecursion > 0; ++$i, --$maxRecursion) { |
|
| 102 | 102 | |
| 103 | 103 | if ($this->isDateRelative($schedule)) { |
| 104 | 104 | if ($this->startTime instanceof \DateTime && $d < $this->startTime->modify($d->format('Y-m-d'))) { |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | $d->modify($schedule); |
| 115 | 115 | } |
| 116 | 116 | elseif ($this->isInTimeFrame($d->modify($schedule), $fromDateStr)) { |
| 117 | - if (!array_key_exists($d->format('YmdHis'), $dates)) { |
|
| 117 | + if (!array_key_exists($d->format('YmdHis'), $dates)) { |
|
| 118 | 118 | $dates[$d->format('YmdHis')] = clone $d; |
| 119 | 119 | } |
| 120 | 120 | } |
@@ -103,8 +103,7 @@ discard block |
||
| 103 | 103 | if ($this->isDateRelative($schedule)) { |
| 104 | 104 | if ($this->startTime instanceof \DateTime && $d < $this->startTime->modify($d->format('Y-m-d'))) { |
| 105 | 105 | $d->modify($this->startTime->format('H:i:s')); |
| 106 | - } |
|
| 107 | - elseif ($this->endTime instanceof \DateTime && $d > $this->endTime->modify($d->format('Y-m-d'))) { |
|
| 106 | + } elseif ($this->endTime instanceof \DateTime && $d > $this->endTime->modify($d->format('Y-m-d'))) { |
|
| 108 | 107 | $d->modify('next day')->modify($this->startTime->format('H:i:s')); |
| 109 | 108 | } |
| 110 | 109 | |
@@ -112,13 +111,11 @@ discard block |
||
| 112 | 111 | $dates[$d->format('YmdHis')] = clone $d; |
| 113 | 112 | } |
| 114 | 113 | $d->modify($schedule); |
| 115 | - } |
|
| 116 | - elseif ($this->isInTimeFrame($d->modify($schedule), $fromDateStr)) { |
|
| 114 | + } elseif ($this->isInTimeFrame($d->modify($schedule), $fromDateStr)) { |
|
| 117 | 115 | if (!array_key_exists($d->format('YmdHis'), $dates)) { |
| 118 | 116 | $dates[$d->format('YmdHis')] = clone $d; |
| 119 | 117 | } |
| 120 | - } |
|
| 121 | - else { |
|
| 118 | + } else { |
|
| 122 | 119 | --$i; |
| 123 | 120 | } |
| 124 | 121 | } |