mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-25 05:03:13 +00:00
Clean up code.
This commit is contained in:
@@ -64,7 +64,7 @@ class BillTransformer extends AbstractTransformer
|
||||
foreach ($objects as $object) {
|
||||
$id = $object->transaction_currency_id;
|
||||
$bills[] = $object->id;
|
||||
$currencies[$id] = $currencies[$id] ?? TransactionCurrency::find($id);
|
||||
$currencies[$id] ??= TransactionCurrency::find($id);
|
||||
}
|
||||
$this->currencies = $currencies;
|
||||
|
||||
@@ -120,7 +120,7 @@ class BillTransformer extends AbstractTransformer
|
||||
$transaction = $transactions[$journal->id] ?? [];
|
||||
$billId = (int)$journal->bill_id;
|
||||
$currencyId = (int)($transaction['transaction_currency_id'] ?? 0);
|
||||
$currencies[$currencyId] = $currencies[$currencyId] ?? TransactionCurrency::find($currencyId);
|
||||
$currencies[$currencyId] ??= TransactionCurrency::find($currencyId);
|
||||
|
||||
// foreign currency
|
||||
$foreignCurrencyId = null;
|
||||
@@ -132,7 +132,7 @@ class BillTransformer extends AbstractTransformer
|
||||
if (null !== $transaction['foreign_currency_id']) {
|
||||
app('log')->debug(sprintf('Foreign currency is #%d', $transaction['foreign_currency_id']));
|
||||
$foreignCurrencyId = (int)$transaction['foreign_currency_id'];
|
||||
$currencies[$foreignCurrencyId] = $currencies[$foreignCurrencyId] ?? TransactionCurrency::find($foreignCurrencyId);
|
||||
$currencies[$foreignCurrencyId] ??= TransactionCurrency::find($foreignCurrencyId);
|
||||
$foreignCurrencyCode = $currencies[$foreignCurrencyId]->code;
|
||||
$foreignCurrencyName = $currencies[$foreignCurrencyId]->name;
|
||||
$foreignCurrencySymbol = $currencies[$foreignCurrencyId]->symbol;
|
||||
|
||||
@@ -92,7 +92,7 @@ class PiggyBankTransformer extends AbstractTransformer
|
||||
foreach ($currencyPreferences as $preference) {
|
||||
$currencyId = (int)$preference->data;
|
||||
$accountId = $preference->account_id;
|
||||
$currencies[$currencyId] = $currencies[$currencyId] ?? TransactionJournal::find($currencyId);
|
||||
$currencies[$currencyId] ??= TransactionJournal::find($currencyId);
|
||||
$this->currencies[$accountId] = $currencies[$currencyId];
|
||||
}
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ class TransactionGroupTransformer extends AbstractTransformer
|
||||
foreach ($objects as $object) {
|
||||
foreach ($object['sums'] as $sum) {
|
||||
$id = (int)$sum['currency_id'];
|
||||
$currencies[$id] = $currencies[$id] ?? TransactionCurrency::find($sum['currency_id']);
|
||||
$currencies[$id] ??= TransactionCurrency::find($sum['currency_id']);
|
||||
}
|
||||
/** @var array $transaction */
|
||||
foreach ($object['transactions'] as $transaction) {
|
||||
|
||||
Reference in New Issue
Block a user