Remove static references

This commit is contained in:
James Cole
2023-10-29 06:33:43 +01:00
parent 075d459b7c
commit 4f2159b54d
205 changed files with 1287 additions and 1287 deletions

View File

@@ -140,30 +140,30 @@ trait CalculateRangeOccurrences
{
$return = [];
$attempts = 0;
Log::debug('Rep is weekly.');
app('log')->debug('Rep is weekly.');
// monday = 1
// sunday = 7
$dayOfWeek = (int)$moment;
Log::debug(sprintf('DoW in repetition is %d, in mutator is %d', $dayOfWeek, $start->dayOfWeekIso));
app('log')->debug(sprintf('DoW in repetition is %d, in mutator is %d', $dayOfWeek, $start->dayOfWeekIso));
if ($start->dayOfWeekIso > $dayOfWeek) {
// day has already passed this week, add one week:
$start->addWeek();
Log::debug(sprintf('Jump to next week, so mutator is now: %s', $start->format('Y-m-d')));
app('log')->debug(sprintf('Jump to next week, so mutator is now: %s', $start->format('Y-m-d')));
}
// today is wednesday (3), expected is friday (5): add two days.
// today is friday (5), expected is monday (1), subtract four days.
Log::debug(sprintf('Mutator is now: %s', $start->format('Y-m-d')));
app('log')->debug(sprintf('Mutator is now: %s', $start->format('Y-m-d')));
$dayDifference = $dayOfWeek - $start->dayOfWeekIso;
$start->addDays($dayDifference);
Log::debug(sprintf('Mutator is now: %s', $start->format('Y-m-d')));
app('log')->debug(sprintf('Mutator is now: %s', $start->format('Y-m-d')));
while ($start <= $end) {
if (0 === $attempts % $skipMod && $start->lte($start) && $end->gte($start)) {
Log::debug('Date is in range of start+end, add to set.');
app('log')->debug('Date is in range of start+end, add to set.');
$return[] = clone $start;
}
$attempts++;
$start->addWeek();
Log::debug(sprintf('Mutator is now (end of loop): %s', $start->format('Y-m-d')));
app('log')->debug(sprintf('Mutator is now (end of loop): %s', $start->format('Y-m-d')));
}
return $return;