mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Code cleanup
This commit is contained in:
@@ -22,7 +22,6 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Import\Storage;
|
||||
|
||||
use ErrorException;
|
||||
use Exception;
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Factory\TransactionJournalFactory;
|
||||
@@ -160,7 +159,7 @@ class ImportStorage
|
||||
try {
|
||||
$this->storeImportJournal($index, $importJournal);
|
||||
$this->addStep();
|
||||
} catch (FireflyException | ErrorException | Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
$this->errors->push($e->getMessage());
|
||||
Log::error(sprintf('Cannot import row #%d because: %s', $index, $e->getMessage()));
|
||||
Log::error($e->getTraceAsString());
|
||||
@@ -239,7 +238,7 @@ class ImportStorage
|
||||
'description' => $importJournal->getDescription(),
|
||||
'piggy_bank_id' => null,
|
||||
'piggy_bank_name' => null,
|
||||
'bill_id' => is_null($bill) ? null : $bill->id,
|
||||
'bill_id' => null === $bill ? null : $bill->id,
|
||||
'bill_name' => null,
|
||||
'tags' => $importJournal->tags,
|
||||
'interest_date' => $importJournal->getMetaDate('interest_date'),
|
||||
@@ -262,14 +261,14 @@ class ImportStorage
|
||||
[
|
||||
'description' => null,
|
||||
'amount' => $amount,
|
||||
'currency_id' => intval($currencyId),
|
||||
'currency_id' => (int)$currencyId,
|
||||
'currency_code' => null,
|
||||
'foreign_amount' => $foreignAmount,
|
||||
'foreign_currency_id' => $foreignCurrencyId,
|
||||
'foreign_currency_code' => null,
|
||||
'budget_id' => is_null($budget) ? null : $budget->id,
|
||||
'budget_id' => null === $budget ? null : $budget->id,
|
||||
'budget_name' => null,
|
||||
'category_id' => is_null($category) ? null : $category->id,
|
||||
'category_id' => null === $category ? null : $category->id,
|
||||
'category_name' => null,
|
||||
'source_id' => $source->id,
|
||||
'source_name' => null,
|
||||
|
||||
@@ -91,7 +91,7 @@ trait ImportSupport
|
||||
*/
|
||||
protected function matchBills(TransactionJournal $journal): bool
|
||||
{
|
||||
if (!is_null($journal->bill_id)) {
|
||||
if (null !== $journal->bill_id) {
|
||||
Log::debug('Journal is already linked to a bill, will not scan.');
|
||||
|
||||
return true;
|
||||
@@ -134,7 +134,7 @@ trait ImportSupport
|
||||
{
|
||||
// start with currency pref of account, if any:
|
||||
$account = $importJournal->asset->getAccount();
|
||||
$currencyId = intval($account->getMeta('currency_id'));
|
||||
$currencyId = (int)$account->getMeta('currency_id');
|
||||
if ($currencyId > 0) {
|
||||
return $currencyId;
|
||||
}
|
||||
@@ -166,7 +166,7 @@ trait ImportSupport
|
||||
{
|
||||
// use given currency by import journal.
|
||||
$currency = $importJournal->foreignCurrency->getTransactionCurrency();
|
||||
if (null !== $currency && intval($currency->id) !== intval($currencyId)) {
|
||||
if (null !== $currency && (int)$currency->id !== (int)$currencyId) {
|
||||
return $currency->id;
|
||||
}
|
||||
|
||||
@@ -206,9 +206,7 @@ trait ImportSupport
|
||||
// amount is positive, it's a deposit, opposing is an revenue:
|
||||
$account->setExpectedType(AccountType::REVENUE);
|
||||
|
||||
$databaseAccount = $account->getAccount();
|
||||
|
||||
return $databaseAccount;
|
||||
return $account->getAccount();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -280,7 +278,6 @@ trait ImportSupport
|
||||
* is not already present.
|
||||
*
|
||||
* @return array
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
private function getTransfers(): array
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user