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

@@ -153,12 +153,12 @@ class ReconcileController extends Controller
'selectedIds'
)
)->render();
// @codeCoverageIgnoreStart
} catch (Throwable $e) {
} catch (Throwable $e) { // @phpstan-ignore-line
Log::debug(sprintf('View error: %s', $e->getMessage()));
$view = sprintf('Could not render accounts.reconcile.overview: %s', $e->getMessage());
}
// @codeCoverageIgnoreEnd
$return = [
'post_uri' => $route,
'html' => $view,
@@ -181,7 +181,7 @@ class ReconcileController extends Controller
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.
// @codeCoverageIgnoreStart
if ($account->id === $journal['source_account_id']) {
if ($currency->id === $journal['currency_id']) {
$toAdd = $journal['amount'];
@@ -198,7 +198,7 @@ class ReconcileController extends Controller
$toAdd = bcmul($journal['foreign_amount'], '-1');
}
}
// @codeCoverageIgnoreEnd
Log::debug(sprintf('Going to add %s to %s', $toAdd, $amount));
$amount = bcadd($amount, $toAdd);
@@ -250,13 +250,13 @@ class ReconcileController extends Controller
'accounts.reconcile.transactions',
compact('account', 'journals', 'currency', 'start', 'end', 'selectionStart', 'selectionEnd')
)->render();
// @codeCoverageIgnoreStart
} catch (Throwable $e) {
} catch (Throwable $e) { // @phpstan-ignore-line
Log::debug(sprintf('Could not render: %s', $e->getMessage()));
$html = sprintf('Could not render accounts.reconcile.transactions: %s', $e->getMessage());
}
// @codeCoverageIgnoreEnd
return response()->json(['html' => $html, 'startBalance' => $startBalance, 'endBalance' => $endBalance]);
}
@@ -275,7 +275,7 @@ class ReconcileController extends Controller
/** @var array $journal */
foreach ($array as $journal) {
$inverse = false;
// @codeCoverageIgnoreStart
if (TransactionType::DEPOSIT === $journal['transaction_type_type']) {
$inverse = true;
}
@@ -296,7 +296,7 @@ class ReconcileController extends Controller
$journal['foreign_amount'] = app('steam')->positive($journal['foreign_amount']);
}
}
// @codeCoverageIgnoreEnd
$journals[] = $journal;
}