Various code cleanup.

This commit is contained in:
James Cole
2021-04-07 07:28:43 +02:00
parent 4ddcb0c965
commit f12744ad8c
180 changed files with 714 additions and 721 deletions

View File

@@ -145,7 +145,7 @@ class SelectController extends Controller
// warn if nothing.
if (0 === count($textTriggers)) {
return response()->json(['html' => '', 'warning' => (string)trans('firefly.warning_no_valid_triggers')]); // @codeCoverageIgnore
return response()->json(['html' => '', 'warning' => (string)trans('firefly.warning_no_valid_triggers')]);
}
foreach ($textTriggers as $textTrigger) {
@@ -168,21 +168,21 @@ class SelectController extends Controller
// Warn the user if only a subset of transactions is returned
$warning = '';
if (0 === count($collection)) {
$warning = (string)trans('firefly.warning_no_matching_transactions'); // @codeCoverageIgnore
$warning = (string)trans('firefly.warning_no_matching_transactions');
}
// Return json response
$view = 'ERROR, see logs.';
try {
$view = prefixView('list.journals-array-tiny', ['groups' => $collection])->render();
// @codeCoverageIgnoreStart
} catch (Throwable $exception) {
} catch (Throwable $exception) { // @phpstan-ignore-line
Log::error(sprintf('Could not render view in testTriggers(): %s', $exception->getMessage()));
Log::error($exception->getTraceAsString());
$view = sprintf('Could not render list.journals-tiny: %s', $exception->getMessage());
}
// @codeCoverageIgnoreEnd
return response()->json(['html' => $view, 'warning' => $warning]);
}
@@ -201,7 +201,7 @@ class SelectController extends Controller
$triggers = $rule->ruleTriggers;
if (0 === count($triggers)) {
return response()->json(['html' => '', 'warning' => (string)trans('firefly.warning_no_valid_triggers')]); // @codeCoverageIgnore
return response()->json(['html' => '', 'warning' => (string)trans('firefly.warning_no_valid_triggers')]);
}
// create new rule engine:
$newRuleEngine = app(RuleEngineInterface::class);
@@ -213,20 +213,20 @@ class SelectController extends Controller
$warning = '';
if (0 === count($collection)) {
$warning = (string)trans('firefly.warning_no_matching_transactions'); // @codeCoverageIgnore
$warning = (string)trans('firefly.warning_no_matching_transactions');
}
// Return json response
$view = 'ERROR, see logs.';
try {
$view = prefixView('list.journals-array-tiny', ['groups' => $collection])->render();
// @codeCoverageIgnoreStart
} catch (Throwable $exception) {
} catch (Throwable $exception) { // @phpstan-ignore-line
Log::error(sprintf('Could not render view in testTriggersByRule(): %s', $exception->getMessage()));
Log::error($exception->getTraceAsString());
}
// @codeCoverageIgnoreEnd
return response()->json(['html' => $view, 'warning' => $warning]);
}