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

@@ -253,7 +253,7 @@ class BoxController extends Controller
$allAccounts = $accountRepository->getActiveAccountsByType(
[AccountType::DEFAULT, AccountType::ASSET, AccountType::LOAN, AccountType::DEBT, AccountType::MORTGAGE]
);
Log::debug(sprintf('Found %d accounts.', $allAccounts->count()));
app('log')->debug(sprintf('Found %d accounts.', $allAccounts->count()));
// filter list on preference of being included.
$filtered = $allAccounts->filter(
@@ -261,7 +261,7 @@ class BoxController extends Controller
$includeNetWorth = $accountRepository->getMetaValue($account, 'include_net_worth');
$result = null === $includeNetWorth ? true : '1' === $includeNetWorth;
if (false === $result) {
Log::debug(sprintf('Will not include "%s" in net worth charts.', $account->name));
app('log')->debug(sprintf('Will not include "%s" in net worth charts.', $account->name));
}
return $result;

View File

@@ -46,12 +46,12 @@ class IntroController extends Controller
*/
public function getIntroSteps(string $route, string $specificPage = null): JsonResponse
{
Log::debug(sprintf('getIntroSteps for route "%s" and page "%s"', $route, $specificPage));
app('log')->debug(sprintf('getIntroSteps for route "%s" and page "%s"', $route, $specificPage));
$specificPage = $specificPage ?? '';
$steps = $this->getBasicSteps($route);
$specificSteps = $this->getSpecificSteps($route, $specificPage);
if (0 === count($specificSteps)) {
Log::debug(sprintf('No specific steps for route "%s" and page "%s"', $route, $specificPage));
app('log')->debug(sprintf('No specific steps for route "%s" and page "%s"', $route, $specificPage));
return response()->json($steps);
}
@@ -81,7 +81,7 @@ class IntroController extends Controller
public function hasOutroStep(string $route): bool
{
$routeKey = str_replace('.', '_', $route);
Log::debug(sprintf('Has outro step for route %s', $routeKey));
app('log')->debug(sprintf('Has outro step for route %s', $routeKey));
$elements = config(sprintf('intro.%s', $routeKey));
if (!is_array($elements)) {
return false;
@@ -89,9 +89,9 @@ class IntroController extends Controller
$hasStep = array_key_exists('outro', $elements);
Log::debug('Elements is array', $elements);
Log::debug('Keys is', array_keys($elements));
Log::debug(sprintf('Keys has "outro": %s', var_export($hasStep, true)));
app('log')->debug('Elements is array', $elements);
app('log')->debug('Keys is', array_keys($elements));
app('log')->debug(sprintf('Keys has "outro": %s', var_export($hasStep, true)));
return $hasStep;
}
@@ -113,7 +113,7 @@ class IntroController extends Controller
if ('' !== $specialPage) {
$key .= '_' . $specialPage;
}
Log::debug(sprintf('Going to mark the following route as NOT done: %s with special "%s" (%s)', $route, $specialPage, $key));
app('log')->debug(sprintf('Going to mark the following route as NOT done: %s with special "%s" (%s)', $route, $specialPage, $key));
app('preferences')->set($key, false);
app('preferences')->mark();
@@ -136,7 +136,7 @@ class IntroController extends Controller
if ('' !== $specialPage) {
$key .= '_' . $specialPage;
}
Log::debug(sprintf('Going to mark the following route as done: %s with special "%s" (%s)', $route, $specialPage, $key));
app('log')->debug(sprintf('Going to mark the following route as done: %s with special "%s" (%s)', $route, $specialPage, $key));
app('preferences')->set($key, true);
return response()->json(['result' => sprintf('Reported demo watched for route "%s" (%s): %s.', $route, $specialPage, $key)]);

View File

@@ -116,13 +116,13 @@ class ReconcileController extends Controller
$clearedJournals = $collector->getExtractedJournals();
}
Log::debug('Start transaction loop');
app('log')->debug('Start transaction loop');
/** @var array $journal */
foreach ($journals as $journal) {
$amount = $this->processJournal($account, $accountCurrency, $journal, $amount);
}
Log::debug(sprintf('Final amount is %s', $amount));
Log::debug('End transaction loop');
app('log')->debug(sprintf('Final amount is %s', $amount));
app('log')->debug('End transaction loop');
/** @var array $journal */
foreach ($clearedJournals as $journal) {
@@ -156,7 +156,7 @@ class ReconcileController extends Controller
)
)->render();
} catch (Throwable $e) {
Log::debug(sprintf('View error: %s', $e->getMessage()));
app('log')->debug(sprintf('View error: %s', $e->getMessage()));
app('log')->error($e->getTraceAsString());
$view = sprintf('Could not render accounts.reconcile.overview: %s', $e->getMessage());
throw new FireflyException($view, 0, $e);
@@ -181,7 +181,7 @@ class ReconcileController extends Controller
private function processJournal(Account $account, TransactionCurrency $currency, array $journal, string $amount): string
{
$toAdd = '0';
Log::debug(sprintf('User submitted %s #%d: "%s"', $journal['transaction_type_type'], $journal['transaction_journal_id'], $journal['description']));
app('log')->debug(sprintf('User submitted %s #%d: "%s"', $journal['transaction_type_type'], $journal['transaction_journal_id'], $journal['description']));
// not much magic below we need to cover using tests.
@@ -203,9 +203,9 @@ class ReconcileController extends Controller
}
Log::debug(sprintf('Going to add %s to %s', $toAdd, $amount));
app('log')->debug(sprintf('Going to add %s to %s', $toAdd, $amount));
$amount = bcadd($amount, $toAdd);
Log::debug(sprintf('Result is %s', $amount));
app('log')->debug(sprintf('Result is %s', $amount));
return $amount;
}
@@ -258,7 +258,7 @@ class ReconcileController extends Controller
compact('account', 'journals', 'currency', 'start', 'end', 'selectionStart', 'selectionEnd')
)->render();
} catch (Throwable $e) {
Log::debug(sprintf('Could not render: %s', $e->getMessage()));
app('log')->debug(sprintf('Could not render: %s', $e->getMessage()));
app('log')->error($e->getTraceAsString());
$html = sprintf('Could not render accounts.reconcile.transactions: %s', $e->getMessage());
throw new FireflyException($html, 0, $e);

View File

@@ -156,12 +156,12 @@ class RecurrenceController extends Controller
$preSelected = (string)$request->get('pre_select');
$locale = app('steam')->getLocale();
Log::debug(sprintf('date = %s, today = %s. date > today? %s', $date->toAtomString(), $today->toAtomString(), var_export($date > $today, true)));
Log::debug(sprintf('past = true? %s', var_export('true' === (string)$request->get('past'), true)));
app('log')->debug(sprintf('date = %s, today = %s. date > today? %s', $date->toAtomString(), $today->toAtomString(), var_export($date > $today, true)));
app('log')->debug(sprintf('past = true? %s', var_export('true' === (string)$request->get('past'), true)));
$result = [];
if ($date > $today || 'true' === (string)$request->get('past')) {
Log::debug('Will fill dropdown.');
app('log')->debug('Will fill dropdown.');
$weekly = sprintf('weekly,%s', $date->dayOfWeekIso);
$monthly = sprintf('monthly,%s', $date->day);
$dayOfWeek = (string)trans(sprintf('config.dow_%s', $date->dayOfWeekIso));
@@ -188,7 +188,7 @@ class RecurrenceController extends Controller
],
];
}
Log::debug('Dropdown is', $result);
app('log')->debug('Dropdown is', $result);
return response()->json($result);
}