Remove static references

This commit is contained in:
James Cole 2023-10-29 06:31:13 +01:00
parent 59d96f2893
commit 91b7d20f9b
No known key found for this signature in database
GPG Key ID: B49A324B7EAD6D80
15 changed files with 39 additions and 39 deletions

View File

@ -216,7 +216,7 @@ class UpgradeLiabilitiesEight extends Command
return;
}
Log::warning('Did not find opening balance.');
app('log')->warning('Did not find opening balance.');
}
/**

View File

@ -54,11 +54,11 @@ class APIEventHandler
} catch (Exception $e) {
$message = $e->getMessage();
if (str_contains($message, 'Bcc')) {
Log::warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');
app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');
return;
}
if (str_contains($message, 'RFC 2822')) {
Log::warning('[RFC] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');
app('log')->warning('[RFC] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');
return;
}
Log::error($e->getMessage());

View File

@ -62,11 +62,11 @@ class AdminEventHandler
} catch (Exception $e) {
$message = $e->getMessage();
if (str_contains($message, 'Bcc')) {
Log::warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');
app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');
return;
}
if (str_contains($message, 'RFC 2822')) {
Log::warning('[RFC] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');
app('log')->warning('[RFC] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');
return;
}
Log::error($e->getMessage());
@ -100,11 +100,11 @@ class AdminEventHandler
} catch (Exception $e) {
$message = $e->getMessage();
if (str_contains($message, 'Bcc')) {
Log::warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');
app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');
return;
}
if (str_contains($message, 'RFC 2822')) {
Log::warning('[RFC] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');
app('log')->warning('[RFC] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');
return;
}
Log::error($e->getMessage());
@ -134,11 +134,11 @@ class AdminEventHandler
} catch (Exception $e) {
$message = $e->getMessage();
if (str_contains($message, 'Bcc')) {
Log::warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');
app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');
return;
}
if (str_contains($message, 'RFC 2822')) {
Log::warning('[RFC] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');
app('log')->warning('[RFC] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');
return;
}
Log::error($e->getMessage());

View File

@ -78,11 +78,11 @@ class AutomationHandler
} catch (Exception $e) {
$message = $e->getMessage();
if (str_contains($message, 'Bcc')) {
Log::warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');
app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');
return;
}
if (str_contains($message, 'RFC 2822')) {
Log::warning('[RFC] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');
app('log')->warning('[RFC] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');
return;
}
Log::error($e->getMessage());

View File

@ -56,11 +56,11 @@ class BillEventHandler
} catch (Exception $e) {
$message = $e->getMessage();
if (str_contains($message, 'Bcc')) {
Log::warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');
app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');
return;
}
if (str_contains($message, 'RFC 2822')) {
Log::warning('[RFC] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');
app('log')->warning('[RFC] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');
return;
}
Log::error($e->getMessage());

View File

@ -65,11 +65,11 @@ class BudgetLimitHandler
Log::debug(sprintf('Now in updateAvailableBudget(#%d)', $budgetLimit->id));
$budget = Budget::find($budgetLimit->budget_id);
if (null === $budget) {
Log::warning('Budget is null, probably deleted, find deleted version.');
app('log')->warning('Budget is null, probably deleted, find deleted version.');
$budget = Budget::withTrashed()->find($budgetLimit->budget_id);
}
if (null === $budget) {
Log::warning('Budget is still null, cannot continue, will delete budget limit.');
app('log')->warning('Budget is still null, cannot continue, will delete budget limit.');
$budgetLimit->forceDelete();
return;
}
@ -77,7 +77,7 @@ class BudgetLimitHandler
// sanity check. It happens when the budget has been deleted so the original user is unknown.
if (null === $user) {
Log::warning('User is null, cannot continue.');
app('log')->warning('User is null, cannot continue.');
$budgetLimit->forceDelete();
return;
}

View File

@ -52,7 +52,7 @@ class PiggyBankEventHandler
->where('transaction_journal_id', $journal->id)
->exists();
if ($exists) {
Log::warning('Already have event for this journal and piggy, will not create another.');
app('log')->warning('Already have event for this journal and piggy, will not create another.');
return;
}
}

View File

@ -207,11 +207,11 @@ class UserEventHandler
} catch (Exception $e) {
$message = $e->getMessage();
if (str_contains($message, 'Bcc')) {
Log::warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');
app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');
return;
}
if (str_contains($message, 'RFC 2822')) {
Log::warning('[RFC] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');
app('log')->warning('[RFC] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');
return;
}
Log::error($e->getMessage());
@ -241,11 +241,11 @@ class UserEventHandler
} catch (Exception $e) {
$message = $e->getMessage();
if (str_contains($message, 'Bcc')) {
Log::warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');
app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');
return;
}
if (str_contains($message, 'RFC 2822')) {
Log::warning('[RFC] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');
app('log')->warning('[RFC] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');
return;
}
Log::error($e->getMessage());
@ -318,11 +318,11 @@ class UserEventHandler
} catch (Exception $e) {
$message = $e->getMessage();
if (str_contains($message, 'Bcc')) {
Log::warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');
app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');
return;
}
if (str_contains($message, 'RFC 2822')) {
Log::warning('[RFC] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');
app('log')->warning('[RFC] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');
return;
}
Log::error($e->getMessage());
@ -366,11 +366,11 @@ class UserEventHandler
} catch (Exception $e) {
$message = $e->getMessage();
if (str_contains($message, 'Bcc')) {
Log::warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');
app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');
return;
}
if (str_contains($message, 'RFC 2822')) {
Log::warning('[RFC] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');
app('log')->warning('[RFC] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');
return;
}
Log::error($e->getMessage());

View File

@ -203,7 +203,7 @@ class DebugController extends Controller
}
} catch (Exception $e) { // generic catch for open basedir.
Log::debug('Could not check build counter, but thats ok.');
Log::warning($e->getMessage());
app('log')->warning($e->getMessage());
}
try {
if (file_exists('/var/www/build-date-main.txt')) {
@ -211,7 +211,7 @@ class DebugController extends Controller
}
} catch (Exception $e) { // generic catch for open basedir.
Log::debug('Could not check build date, but thats ok.');
Log::warning($e->getMessage());
app('log')->warning($e->getMessage());
}
if ('' !== (string)env('BASE_IMAGE_BUILD')) {
$return['base_build'] = env('BASE_IMAGE_BUILD');

View File

@ -128,7 +128,7 @@ class Authenticate
private function validateBlockedUser(?User $user, array $guards): void
{
if (null === $user) {
Log::warning('User is null, throw exception?');
app('log')->warning('User is null, throw exception?');
}
if (null !== $user) {
// Log::debug(get_class($user));
@ -137,7 +137,7 @@ class Authenticate
if ('email_changed' === $user->blocked_code) {
$message = (string)trans('firefly.email_changed_logout');
}
Log::warning('User is blocked, cannot use authentication method.');
app('log')->warning('User is blocked, cannot use authentication method.');
app('session')->flash('logoutMessage', $message);
/** @noinspection PhpUndefinedMethodInspection */
$this->auth->logout(); // @phpstan-ignore-line (thinks function is undefined)

View File

@ -95,11 +95,11 @@ class MailError extends Job implements ShouldQueue
} catch (Exception | TransportException $e) { // intentional generic exception
$message = $e->getMessage();
if (str_contains($message, 'Bcc')) {
Log::warning('[Bcc] Could not email or log the error. Please validate your email settings, use the .env.example file as a guide.');
app('log')->warning('[Bcc] Could not email or log the error. Please validate your email settings, use the .env.example file as a guide.');
return;
}
if (str_contains($message, 'RFC 2822')) {
Log::warning('[RFC] Could not email or log the error. Please validate your email settings, use the .env.example file as a guide.');
app('log')->warning('[RFC] Could not email or log the error. Please validate your email settings, use the .env.example file as a guide.');
return;
}
Log::error($e->getMessage());

View File

@ -433,7 +433,7 @@ class CreditRecalculateService
return $result;
}
Log::warning(sprintf('[-1] Catch-all, should not happen. Left of debt = %s', app('steam')->bcround($leftOfDebt, $decimals)));
app('log')->warning(sprintf('[-1] Catch-all, should not happen. Left of debt = %s', app('steam')->bcround($leftOfDebt, $decimals)));
return $leftOfDebt;
}

View File

@ -224,7 +224,7 @@ class RecurrenceUpdateService
Log::debug(sprintf('Original count is %d', $originalCount));
if (0 === count($transactions)) {
// won't drop transactions, rather avoid.
Log::warning('No transactions to update, too scared to continue!');
app('log')->warning('No transactions to update, too scared to continue!');
return;
}
$combinations = [];

View File

@ -111,7 +111,7 @@ class Navigation
try {
return $this->calculator->nextDateByInterval($epoch, $periodicity, $skipInterval);
} catch (IntervalException $exception) {
Log::warning($exception->getMessage(), ['exception' => $exception]);
app('log')->warning($exception->getMessage(), ['exception' => $exception]);
} catch (Throwable $exception) {
Log::error($exception->getMessage(), ['exception' => $exception]);
}

View File

@ -340,12 +340,12 @@ trait RecurrenceValidation
//$recurrence = $validator->get
if (null === $transactions) {
Log::warning('[a] User submitted no transactions.');
app('log')->warning('[a] User submitted no transactions.');
$validator->errors()->add('transactions', (string)trans('validation.at_least_one_transaction'));
return;
}
if (0 === $submittedTrCount) {
Log::warning('[b] User submitted no transactions.');
app('log')->warning('[b] User submitted no transactions.');
$validator->errors()->add('transactions', (string)trans('validation.at_least_one_transaction'));
return;
}
@ -393,12 +393,12 @@ trait RecurrenceValidation
foreach ($transactions as $index => $transaction) {
Log::debug(sprintf('Now at %d/%d', $index + 1, $submittedTrCount));
if (!is_array($transaction)) {
Log::warning('Not an array. Give error.');
app('log')->warning('Not an array. Give error.');
$validator->errors()->add(sprintf('transactions.%d.id', $index), (string)trans('validation.at_least_one_transaction'));
return;
}
if (!array_key_exists('id', $transaction) && $idsMandatory) {
Log::warning('ID is mandatory but array has no ID.');
app('log')->warning('ID is mandatory but array has no ID.');
$validator->errors()->add(sprintf('transactions.%d.id', $index), (string)trans('validation.need_id_to_match'));
return;
}
@ -419,7 +419,7 @@ trait RecurrenceValidation
$maxUnmatched = max(1, $submittedTrCount - $originalTrCount);
Log::debug(sprintf('Submitted: %d. Original: %d. User can submit %d unmatched transactions.', $submittedTrCount, $originalTrCount, $maxUnmatched));
if ($unmatchedIds > $maxUnmatched) {
Log::warning(sprintf('Too many unmatched transactions (%d).', $unmatchedIds));
app('log')->warning(sprintf('Too many unmatched transactions (%d).', $unmatchedIds));
$validator->errors()->add('transactions.0.id', (string)trans('validation.too_many_unmatched'));
return;
}