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

@@ -67,7 +67,7 @@ class WarnAboutBills implements ShouldQueue
$this->force = false;
Log::debug(sprintf('Created new WarnAboutBills("%s")', $this->date->format('Y-m-d')));
app('log')->debug(sprintf('Created new WarnAboutBills("%s")', $this->date->format('Y-m-d')));
}
/**
@@ -75,11 +75,11 @@ class WarnAboutBills implements ShouldQueue
*/
public function handle(): void
{
Log::debug(sprintf('Now at start of WarnAboutBills() job for %s.', $this->date->format('D d M Y')));
app('log')->debug(sprintf('Now at start of WarnAboutBills() job for %s.', $this->date->format('D d M Y')));
$bills = Bill::all();
/** @var Bill $bill */
foreach ($bills as $bill) {
Log::debug(sprintf('Now checking bill #%d ("%s")', $bill->id, $bill->name));
app('log')->debug(sprintf('Now checking bill #%d ("%s")', $bill->id, $bill->name));
if ($this->hasDateFields($bill)) {
if ($this->needsWarning($bill, 'end_date')) {
$this->sendWarning($bill, 'end_date');
@@ -89,7 +89,7 @@ class WarnAboutBills implements ShouldQueue
}
}
}
Log::debug('Done with handle()');
app('log')->debug('Done with handle()');
// clear cache:
app('preferences')->mark();
@@ -103,11 +103,11 @@ class WarnAboutBills implements ShouldQueue
private function hasDateFields(Bill $bill): bool
{
if (false === $bill->active) {
Log::debug('Bill is not active.');
app('log')->debug('Bill is not active.');
return false;
}
if (null === $bill->end_date && null === $bill->extension_date) {
Log::debug('Bill has no date fields.');
app('log')->debug('Bill has no date fields.');
return false;
}
return true;
@@ -126,7 +126,7 @@ class WarnAboutBills implements ShouldQueue
}
$diff = $this->getDiff($bill, $field);
$list = config('firefly.bill_reminder_periods');
Log::debug(sprintf('Difference in days for field "%s" ("%s") is %d day(s)', $field, $bill->$field->format('Y-m-d'), $diff));
app('log')->debug(sprintf('Difference in days for field "%s" ("%s") is %d day(s)', $field, $bill->$field->format('Y-m-d'), $diff));
if (in_array($diff, $list, true)) {
return true;
}
@@ -155,7 +155,7 @@ class WarnAboutBills implements ShouldQueue
private function sendWarning(Bill $bill, string $field): void
{
$diff = $this->getDiff($bill, $field);
Log::debug('Will now send warning!');
app('log')->debug('Will now send warning!');
event(new WarnUserAboutBill($bill, $field, $diff));
}