mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2026-05-04 21:23:36 +00:00
Various code cleanup.
This commit is contained in:
@@ -57,7 +57,7 @@ class StageAuthenticatedHandler
|
||||
$config = $this->importJob->configuration;
|
||||
$logins = $config['all-logins'] ?? [];
|
||||
Log::debug(sprintf('%d logins in config', \count($logins)));
|
||||
if (\count($logins) === 0) {
|
||||
if (0 === \count($logins)) {
|
||||
// get logins from Spectre.
|
||||
$logins = $this->getLogins();
|
||||
$config['all-logins'] = $logins;
|
||||
|
||||
@@ -60,7 +60,7 @@ class StageImportDataHandler
|
||||
$config = $this->importJob->configuration;
|
||||
$accounts = $config['accounts'] ?? [];
|
||||
Log::debug(sprintf('Count of accounts in array is %d', \count($accounts)));
|
||||
if (\count($accounts) === 0) {
|
||||
if (0 === \count($accounts)) {
|
||||
throw new FireflyException('There are no accounts in this import job. Cannot continue.'); // @codeCoverageIgnore
|
||||
}
|
||||
$toImport = $config['account_mapping'] ?? [];
|
||||
@@ -124,14 +124,14 @@ class StageImportDataHandler
|
||||
$amount = $transaction->getAmount();
|
||||
$source = $originalSource;
|
||||
$destination = $this->mapper->map(null, $amount, $destinationData);
|
||||
$notes = (string)trans('import.imported_from_account', ['account' => $spectreAccount->getName()]) . ' ' . "\n";
|
||||
$notes = trans('import.imported_from_account', ['account' => $spectreAccount->getName()]) . ' ' . "\n";
|
||||
$foreignAmount = null;
|
||||
$foreignCurrencyCode = null;
|
||||
|
||||
$currencyCode = $transaction->getCurrencyCode();
|
||||
$type = 'withdrawal';
|
||||
// switch source and destination if amount is greater than zero.
|
||||
if (bccomp($amount, '0') === 1) {
|
||||
if (1 === bccomp($amount, '0')) {
|
||||
[$source, $destination] = [$destination, $source];
|
||||
$type = 'deposit';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user