mirror of
				https://github.com/firefly-iii/firefly-iii.git
				synced 2025-10-31 02:36:28 +00:00 
			
		
		
		
	Clean up code.
This commit is contained in:
		| @@ -97,9 +97,9 @@ class ShowController extends Controller | ||||
|         } | ||||
| 
 | ||||
|         /** @var Carbon $start */ | ||||
|         $start = $start ?? session('start'); | ||||
|         $start ??= session('start'); | ||||
|         /** @var Carbon $end */ | ||||
|         $end = $end ?? session('end'); | ||||
|         $end ??= session('end'); | ||||
| 
 | ||||
|         if ($end < $start) { | ||||
|             [$start, $end] = [$end, $start]; | ||||
|   | ||||
| @@ -109,7 +109,7 @@ class IndexController extends Controller | ||||
|             $array      = $transformer->transform($bill); | ||||
|             $groupOrder = (int)$array['object_group_order']; | ||||
|             // make group array if necessary:
 | ||||
|             $bills[$groupOrder] = $bills[$groupOrder] ?? [ | ||||
|             $bills[$groupOrder] ??= [ | ||||
|                 'object_group_id'    => $array['object_group_id'], | ||||
|                 'object_group_title' => $array['object_group_title'], | ||||
|                 'bills'              => [], | ||||
| @@ -159,7 +159,7 @@ class IndexController extends Controller | ||||
|                 } | ||||
| 
 | ||||
|                 $currencyId                     = $bill['currency_id']; | ||||
|                 $sums[$groupOrder][$currencyId] = $sums[$groupOrder][$currencyId] ?? [ | ||||
|                 $sums[$groupOrder][$currencyId] ??= [ | ||||
|                     'currency_id'             => $currencyId, | ||||
|                     'currency_code'           => $bill['currency_code'], | ||||
|                     'currency_name'           => $bill['currency_name'], | ||||
| @@ -249,7 +249,7 @@ class IndexController extends Controller | ||||
|              * @var array $entry | ||||
|              */ | ||||
|             foreach ($array as $currencyId => $entry) { | ||||
|                 $totals[$currencyId]               = $totals[$currencyId] ?? [ | ||||
|                 $totals[$currencyId] ??= [ | ||||
|                     'currency_id'             => $currencyId, | ||||
|                     'currency_code'           => $entry['currency_code'], | ||||
|                     'currency_name'           => $entry['currency_name'], | ||||
|   | ||||
| @@ -105,14 +105,14 @@ class IndexController extends Controller | ||||
|         $range         = app('navigation')->getViewRange(true); | ||||
|         $isCustomRange = session('is_custom_range', false); | ||||
|         if (false === $isCustomRange) { | ||||
|             $start = $start ?? session('start', today(config('app.timezone'))->startOfMonth()); | ||||
|             $end   = $end ?? app('navigation')->endOfPeriod($start, $range); | ||||
|             $start ??= session('start', today(config('app.timezone'))->startOfMonth()); | ||||
|             $end ??= app('navigation')->endOfPeriod($start, $range); | ||||
|         } | ||||
| 
 | ||||
|         // overrule start and end if necessary:
 | ||||
|         if (true === $isCustomRange) { | ||||
|             $start = $start ?? session('start', today(config('app.timezone'))->startOfMonth()); | ||||
|             $end   = $end ?? session('end', today(config('app.timezone'))->endOfMonth()); | ||||
|             $start ??= session('start', today(config('app.timezone'))->startOfMonth()); | ||||
|             $end ??= session('end', today(config('app.timezone'))->endOfMonth()); | ||||
|         } | ||||
| 
 | ||||
| 
 | ||||
| @@ -135,7 +135,7 @@ class IndexController extends Controller | ||||
| 
 | ||||
|         // get budgeted for default currency:
 | ||||
|         if (0 === count($availableBudgets)) { | ||||
|             $budgeted = $this->blRepository->budgeted($start, $end, $defaultCurrency,); | ||||
|             $budgeted = $this->blRepository->budgeted($start, $end, $defaultCurrency, ); | ||||
|             $spentArr = $this->opsRepository->sumExpenses($start, $end, null, null, $defaultCurrency); | ||||
|             $spent    = $spentArr[$defaultCurrency->id]['sum'] ?? '0'; | ||||
|             unset($spentArr); | ||||
| @@ -194,7 +194,7 @@ class IndexController extends Controller | ||||
|             $array['spent'] = $spentArr[$entry->transaction_currency_id]['sum'] ?? '0'; | ||||
| 
 | ||||
|             // budgeted in period:
 | ||||
|             $budgeted           = $this->blRepository->budgeted($entry->start_date, $entry->end_date, $entry->transactionCurrency,); | ||||
|             $budgeted           = $this->blRepository->budgeted($entry->start_date, $entry->end_date, $entry->transactionCurrency, ); | ||||
|             $array['budgeted']  = $budgeted; | ||||
|             $availableBudgets[] = $array; | ||||
|             unset($spentArr); | ||||
| @@ -283,8 +283,8 @@ class IndexController extends Controller | ||||
|             foreach ($budget['spent'] as $spent) { | ||||
|                 $currencyId                           = $spent['currency_id']; | ||||
|                 $sums['spent'][$currencyId] | ||||
|                                                       = $sums['spent'][$currencyId] | ||||
|                                                         ?? [ | ||||
|                                                       ??=  | ||||
|                                                          [ | ||||
|                                                             'amount'                  => '0', | ||||
|                                                             'currency_id'             => $spent['currency_id'], | ||||
|                                                             'currency_symbol'         => $spent['currency_symbol'], | ||||
| @@ -297,8 +297,8 @@ class IndexController extends Controller | ||||
|             foreach ($budget['budgeted'] as $budgeted) { | ||||
|                 $currencyId                              = $budgeted['currency_id']; | ||||
|                 $sums['budgeted'][$currencyId] | ||||
|                                                          = $sums['budgeted'][$currencyId] | ||||
|                                                            ?? [ | ||||
|                                                          ??=  | ||||
|                                                             [ | ||||
|                                                                'amount'                  => '0', | ||||
|                                                                'currency_id'             => $budgeted['currency_id'], | ||||
|                                                                'currency_symbol'         => $budgeted['currency_symbol'], | ||||
| @@ -307,8 +307,8 @@ class IndexController extends Controller | ||||
|                 $sums['budgeted'][$currencyId]['amount'] = bcadd($sums['budgeted'][$currencyId]['amount'], $budgeted['amount']); | ||||
| 
 | ||||
|                 // also calculate how much left from budgeted:
 | ||||
|                 $sums['left'][$currencyId] = $sums['left'][$currencyId] | ||||
|                                              ?? [ | ||||
|                 $sums['left'][$currencyId] ??=  | ||||
|                                               [ | ||||
|                                                  'amount'                  => '0', | ||||
|                                                  'currency_id'             => $budgeted['currency_id'], | ||||
|                                                  'currency_symbol'         => $budgeted['currency_symbol'], | ||||
|   | ||||
| @@ -88,9 +88,9 @@ class ShowController extends Controller | ||||
|     public function noBudget(Request $request, Carbon $start = null, Carbon $end = null) | ||||
|     { | ||||
|         /** @var Carbon $start */ | ||||
|         $start = $start ?? session('start'); | ||||
|         $start ??= session('start'); | ||||
|         /** @var Carbon $end */ | ||||
|         $end      = $end ?? session('end'); | ||||
|         $end ??= session('end'); | ||||
|         $subTitle = trans( | ||||
|             'firefly.without_budget_between', | ||||
|             ['start' => $start->isoFormat($this->monthAndDayFormat), 'end' => $end->isoFormat($this->monthAndDayFormat)] | ||||
|   | ||||
| @@ -84,9 +84,9 @@ class NoCategoryController extends Controller | ||||
|     { | ||||
|         app('log')->debug('Start of noCategory()'); | ||||
|         /** @var Carbon $start */ | ||||
|         $start = $start ?? session('start'); | ||||
|         $start ??= session('start'); | ||||
|         /** @var Carbon $end */ | ||||
|         $end      = $end ?? session('end'); | ||||
|         $end ??= session('end'); | ||||
|         $page     = (int)$request->get('page'); | ||||
|         $pageSize = (int)app('preferences')->get('listPageSize', 50)->data; | ||||
|         $subTitle = trans( | ||||
|   | ||||
| @@ -86,9 +86,9 @@ class ShowController extends Controller | ||||
|     public function show(Request $request, Category $category, Carbon $start = null, Carbon $end = null) | ||||
|     { | ||||
|         /** @var Carbon $start */ | ||||
|         $start = $start ?? session('start', today(config('app.timezone'))->startOfMonth()); | ||||
|         $start ??= session('start', today(config('app.timezone'))->startOfMonth()); | ||||
|         /** @var Carbon $end */ | ||||
|         $end          = $end ?? session('end', today(config('app.timezone'))->endOfMonth()); | ||||
|         $end ??= session('end', today(config('app.timezone'))->endOfMonth()); | ||||
|         $subTitleIcon = 'fa-bookmark'; | ||||
|         $page         = (int)$request->get('page'); | ||||
|         $attachments  = $this->repository->getAttachments($category); | ||||
|   | ||||
| @@ -125,7 +125,7 @@ class AccountController extends Controller | ||||
|                 // grab the difference and find the currency.
 | ||||
|                 $startAmount             = (string)($startBalances[$accountId][$currencyId] ?? '0'); | ||||
|                 $diff                    = bcsub((string)$endAmount, $startAmount); | ||||
|                 $currencies[$currencyId] = $currencies[$currencyId] ?? $this->currencyRepository->find($currencyId); | ||||
|                 $currencies[$currencyId] ??= $this->currencyRepository->find($currencyId); | ||||
|                 if (0 !== bccomp($diff, '0')) { | ||||
|                     // store the values in a temporary array.
 | ||||
|                     $tempData[] = [ | ||||
| @@ -585,7 +585,7 @@ class AccountController extends Controller | ||||
|                 // grab the difference and find the currency.
 | ||||
|                 $startAmount             = (string)($startBalances[$accountId][$currencyId] ?? '0'); | ||||
|                 $diff                    = bcsub((string)$endAmount, $startAmount); | ||||
|                 $currencies[$currencyId] = $currencies[$currencyId] ?? $this->currencyRepository->find($currencyId); | ||||
|                 $currencies[$currencyId] ??= $this->currencyRepository->find($currencyId); | ||||
|                 if (0 !== bccomp($diff, '0')) { | ||||
|                     // store the values in a temporary array.
 | ||||
|                     $tempData[] = [ | ||||
|   | ||||
| @@ -117,7 +117,7 @@ class BudgetController extends Controller | ||||
| 
 | ||||
|             foreach ($spent as $row) { | ||||
|                 $currencyId              = $row['currency_id']; | ||||
|                 $currencies[$currencyId] = $currencies[$currencyId] ?? $row; // don't mind the field 'sum'
 | ||||
|                 $currencies[$currencyId] ??= $row; // don't mind the field 'sum'
 | ||||
|                 // also store this day's sum:
 | ||||
|                 $currencies[$currencyId]['spent'][$label] = $row['sum']; | ||||
|             } | ||||
| @@ -237,7 +237,7 @@ class BudgetController extends Controller | ||||
|         // group by asset account ID:
 | ||||
|         foreach ($journals as $journal) { | ||||
|             $key                    = sprintf('%d-%d', (int)$journal['source_account_id'], $journal['currency_id']); | ||||
|             $result[$key]           = $result[$key] ?? [ | ||||
|             $result[$key] ??= [ | ||||
|                 'amount'          => '0', | ||||
|                 'currency_symbol' => $journal['currency_symbol'], | ||||
|                 'currency_code'   => $journal['currency_code'], | ||||
| @@ -302,7 +302,7 @@ class BudgetController extends Controller | ||||
|         $chartData = []; | ||||
|         foreach ($journals as $journal) { | ||||
|             $key                    = sprintf('%d-%d', $journal['category_id'], $journal['currency_id']); | ||||
|             $result[$key]           = $result[$key] ?? [ | ||||
|             $result[$key] ??= [ | ||||
|                 'amount'          => '0', | ||||
|                 'currency_symbol' => $journal['currency_symbol'], | ||||
|                 'currency_code'   => $journal['currency_code'], | ||||
| @@ -367,7 +367,7 @@ class BudgetController extends Controller | ||||
|         /** @var array $journal */ | ||||
|         foreach ($journals as $journal) { | ||||
|             $key                    = sprintf('%d-%d', $journal['destination_account_id'], $journal['currency_id']); | ||||
|             $result[$key]           = $result[$key] ?? [ | ||||
|             $result[$key] ??= [ | ||||
|                 'amount'          => '0', | ||||
|                 'currency_symbol' => $journal['currency_symbol'], | ||||
|                 'currency_code'   => $journal['currency_code'], | ||||
|   | ||||
| @@ -87,7 +87,7 @@ class BudgetReportController extends Controller | ||||
|         foreach ($spent as $currency) { | ||||
|             foreach ($currency['budgets'] as $budget) { | ||||
|                 $title          = sprintf('%s (%s)', $budget['name'], $currency['currency_name']); | ||||
|                 $result[$title] = $result[$title] ?? [ | ||||
|                 $result[$title] ??= [ | ||||
|                     'amount'          => '0', | ||||
|                     'currency_symbol' => $currency['currency_symbol'], | ||||
|                     'currency_code'   => $currency['currency_code'], | ||||
| @@ -124,7 +124,7 @@ class BudgetReportController extends Controller | ||||
|                 foreach ($budget['transaction_journals'] as $journal) { | ||||
|                     $categoryName   = $journal['category_name'] ?? trans('firefly.no_category'); | ||||
|                     $title          = sprintf('%s (%s)', $categoryName, $currency['currency_name']); | ||||
|                     $result[$title] = $result[$title] ?? [ | ||||
|                     $result[$title] ??= [ | ||||
|                         'amount'          => '0', | ||||
|                         'currency_symbol' => $currency['currency_symbol'], | ||||
|                         'currency_code'   => $currency['currency_code'], | ||||
| @@ -161,7 +161,7 @@ class BudgetReportController extends Controller | ||||
|             foreach ($currency['budgets'] as $budget) { | ||||
|                 foreach ($budget['transaction_journals'] as $journal) { | ||||
|                     $title          = sprintf('%s (%s)', $journal['destination_account_name'], $currency['currency_name']); | ||||
|                     $result[$title] = $result[$title] ?? [ | ||||
|                     $result[$title] ??= [ | ||||
|                         'amount'          => '0', | ||||
|                         'currency_symbol' => $currency['currency_symbol'], | ||||
|                         'currency_code'   => $currency['currency_code'], | ||||
| @@ -198,7 +198,7 @@ class BudgetReportController extends Controller | ||||
|         foreach ($spent as $currency) { | ||||
|             // add things to chart Data for each currency:
 | ||||
|             $spentKey             = sprintf('%d-spent', $currency['currency_id']); | ||||
|             $chartData[$spentKey] = $chartData[$spentKey] ?? [ | ||||
|             $chartData[$spentKey] ??= [ | ||||
|                 'label'           => sprintf( | ||||
|                     '%s (%s)', | ||||
|                     (string)trans('firefly.spent_in_specific_budget', ['budget' => $budget->name]), | ||||
| @@ -215,7 +215,7 @@ class BudgetReportController extends Controller | ||||
|                 foreach ($currentBudget['transaction_journals'] as $journal) { | ||||
|                     $key                                   = $journal['date']->isoFormat($format); | ||||
|                     $amount                                = app('steam')->positive($journal['amount']); | ||||
|                     $chartData[$spentKey]['entries'][$key] = $chartData[$spentKey]['entries'][$key] ?? '0'; | ||||
|                     $chartData[$spentKey]['entries'][$key] ??= '0'; | ||||
|                     $chartData[$spentKey]['entries'][$key] = bcadd($chartData[$spentKey]['entries'][$key], $amount); | ||||
|                 } | ||||
|             } | ||||
| @@ -269,7 +269,7 @@ class BudgetReportController extends Controller | ||||
|             foreach ($currency['budgets'] as $budget) { | ||||
|                 foreach ($budget['transaction_journals'] as $journal) { | ||||
|                     $title          = sprintf('%s (%s)', $journal['source_account_name'], $currency['currency_name']); | ||||
|                     $result[$title] = $result[$title] ?? [ | ||||
|                     $result[$title] ??= [ | ||||
|                         'amount'          => '0', | ||||
|                         'currency_symbol' => $currency['currency_symbol'], | ||||
|                         'currency_code'   => $currency['currency_code'], | ||||
|   | ||||
| @@ -235,7 +235,7 @@ class CategoryController extends Controller | ||||
|             foreach ($outSet['transaction_journals'] as $journal) { | ||||
|                 $amount                               = app('steam')->positive($journal['amount']); | ||||
|                 $date                                 = $journal['date']->isoFormat($format); | ||||
|                 $chartData[$outKey]['entries'][$date] = $chartData[$outKey]['entries'][$date] ?? '0'; | ||||
|                 $chartData[$outKey]['entries'][$date] ??= '0'; | ||||
| 
 | ||||
|                 $chartData[$outKey]['entries'][$date] = bcadd($amount, $chartData[$outKey]['entries'][$date]); | ||||
|             } | ||||
| @@ -244,7 +244,7 @@ class CategoryController extends Controller | ||||
|             foreach ($inSet['transaction_journals'] as $journal) { | ||||
|                 $amount                              = app('steam')->positive($journal['amount']); | ||||
|                 $date                                = $journal['date']->isoFormat($format); | ||||
|                 $chartData[$inKey]['entries'][$date] = $chartData[$inKey]['entries'][$date] ?? '0'; | ||||
|                 $chartData[$inKey]['entries'][$date] ??= '0'; | ||||
|                 $chartData[$inKey]['entries'][$date] = bcadd($amount, $chartData[$inKey]['entries'][$date]); | ||||
|             } | ||||
|         } | ||||
|   | ||||
| @@ -86,7 +86,7 @@ class CategoryReportController extends Controller | ||||
|                 foreach ($category['transaction_journals'] as $journal) { | ||||
|                     $objectName               = $journal['budget_name'] ?? trans('firefly.no_budget'); | ||||
|                     $title                    = sprintf('%s (%s)', $objectName, $currency['currency_name']); | ||||
|                     $result[$title]           = $result[$title] ?? [ | ||||
|                     $result[$title] ??= [ | ||||
|                         'amount'          => '0', | ||||
|                         'currency_symbol' => $currency['currency_symbol'], | ||||
|                         'currency_code'   => $currency['currency_code'], | ||||
| @@ -120,7 +120,7 @@ class CategoryReportController extends Controller | ||||
|             /** @var array $category */ | ||||
|             foreach ($currency['categories'] as $category) { | ||||
|                 $title          = sprintf('%s (%s)', $category['name'], $currency['currency_name']); | ||||
|                 $result[$title] = $result[$title] ?? [ | ||||
|                 $result[$title] ??= [ | ||||
|                     'amount'          => '0', | ||||
|                     'currency_symbol' => $currency['currency_symbol'], | ||||
|                     'currency_code'   => $currency['currency_code'], | ||||
| @@ -155,7 +155,7 @@ class CategoryReportController extends Controller | ||||
|             /** @var array $category */ | ||||
|             foreach ($currency['categories'] as $category) { | ||||
|                 $title          = sprintf('%s (%s)', $category['name'], $currency['currency_name']); | ||||
|                 $result[$title] = $result[$title] ?? [ | ||||
|                 $result[$title] ??= [ | ||||
|                     'amount'          => '0', | ||||
|                     'currency_symbol' => $currency['currency_symbol'], | ||||
|                     'currency_code'   => $currency['currency_code'], | ||||
| @@ -192,7 +192,7 @@ class CategoryReportController extends Controller | ||||
|                 foreach ($category['transaction_journals'] as $journal) { | ||||
|                     $objectName               = $journal['destination_account_name'] ?? trans('firefly.empty'); | ||||
|                     $title                    = sprintf('%s (%s)', $objectName, $currency['currency_name']); | ||||
|                     $result[$title]           = $result[$title] ?? [ | ||||
|                     $result[$title] ??= [ | ||||
|                         'amount'          => '0', | ||||
|                         'currency_symbol' => $currency['currency_symbol'], | ||||
|                         'currency_code'   => $currency['currency_code'], | ||||
| @@ -228,7 +228,7 @@ class CategoryReportController extends Controller | ||||
|                 foreach ($category['transaction_journals'] as $journal) { | ||||
|                     $objectName               = $journal['destination_account_name'] ?? trans('firefly.empty'); | ||||
|                     $title                    = sprintf('%s (%s)', $objectName, $currency['currency_name']); | ||||
|                     $result[$title]           = $result[$title] ?? [ | ||||
|                     $result[$title] ??= [ | ||||
|                         'amount'          => '0', | ||||
|                         'currency_symbol' => $currency['currency_symbol'], | ||||
|                         'currency_code'   => $currency['currency_code'], | ||||
| @@ -264,7 +264,7 @@ class CategoryReportController extends Controller | ||||
|         foreach ($spent as $currency) { | ||||
|             // add things to chart Data for each currency:
 | ||||
|             $spentKey             = sprintf('%d-spent', $currency['currency_id']); | ||||
|             $chartData[$spentKey] = $chartData[$spentKey] ?? [ | ||||
|             $chartData[$spentKey] ??= [ | ||||
|                 'label'           => sprintf( | ||||
|                     '%s (%s)', | ||||
|                     (string)trans('firefly.spent_in_specific_category', ['category' => $category->name]), | ||||
| @@ -281,7 +281,7 @@ class CategoryReportController extends Controller | ||||
|                 foreach ($currentCategory['transaction_journals'] as $journal) { | ||||
|                     $key                                   = $journal['date']->isoFormat($format); | ||||
|                     $amount                                = app('steam')->positive($journal['amount']); | ||||
|                     $chartData[$spentKey]['entries'][$key] = $chartData[$spentKey]['entries'][$key] ?? '0'; | ||||
|                     $chartData[$spentKey]['entries'][$key] ??= '0'; | ||||
|                     $chartData[$spentKey]['entries'][$key] = bcadd($chartData[$spentKey]['entries'][$key], $amount); | ||||
|                 } | ||||
|             } | ||||
| @@ -291,7 +291,7 @@ class CategoryReportController extends Controller | ||||
|         foreach ($earned as $currency) { | ||||
|             // add things to chart Data for each currency:
 | ||||
|             $spentKey             = sprintf('%d-earned', $currency['currency_id']); | ||||
|             $chartData[$spentKey] = $chartData[$spentKey] ?? [ | ||||
|             $chartData[$spentKey] ??= [ | ||||
|                 'label'           => sprintf( | ||||
|                     '%s (%s)', | ||||
|                     (string)trans('firefly.earned_in_specific_category', ['category' => $category->name]), | ||||
| @@ -308,7 +308,7 @@ class CategoryReportController extends Controller | ||||
|                 foreach ($currentCategory['transaction_journals'] as $journal) { | ||||
|                     $key                                   = $journal['date']->isoFormat($format); | ||||
|                     $amount                                = app('steam')->positive($journal['amount']); | ||||
|                     $chartData[$spentKey]['entries'][$key] = $chartData[$spentKey]['entries'][$key] ?? '0'; | ||||
|                     $chartData[$spentKey]['entries'][$key] ??= '0'; | ||||
|                     $chartData[$spentKey]['entries'][$key] = bcadd($chartData[$spentKey]['entries'][$key], $amount); | ||||
|                 } | ||||
|             } | ||||
| @@ -364,7 +364,7 @@ class CategoryReportController extends Controller | ||||
|                 foreach ($category['transaction_journals'] as $journal) { | ||||
|                     $objectName               = $journal['source_account_name'] ?? trans('firefly.empty'); | ||||
|                     $title                    = sprintf('%s (%s)', $objectName, $currency['currency_name']); | ||||
|                     $result[$title]           = $result[$title] ?? [ | ||||
|                     $result[$title] ??= [ | ||||
|                         'amount'          => '0', | ||||
|                         'currency_symbol' => $currency['currency_symbol'], | ||||
|                         'currency_code'   => $currency['currency_code'], | ||||
| @@ -400,7 +400,7 @@ class CategoryReportController extends Controller | ||||
|                 foreach ($category['transaction_journals'] as $journal) { | ||||
|                     $objectName               = $journal['source_account_name'] ?? trans('firefly.empty'); | ||||
|                     $title                    = sprintf('%s (%s)', $objectName, $currency['currency_name']); | ||||
|                     $result[$title]           = $result[$title] ?? [ | ||||
|                     $result[$title] ??= [ | ||||
|                         'amount'          => '0', | ||||
|                         'currency_symbol' => $currency['currency_symbol'], | ||||
|                         'currency_code'   => $currency['currency_code'], | ||||
|   | ||||
| @@ -85,7 +85,7 @@ class DoubleReportController extends Controller | ||||
|             foreach ($currency['transaction_journals'] as $journal) { | ||||
|                 $categoryName             = $journal['budget_name'] ?? trans('firefly.no_budget'); | ||||
|                 $title                    = sprintf('%s (%s)', $categoryName, $currency['currency_name']); | ||||
|                 $result[$title]           = $result[$title] ?? [ | ||||
|                 $result[$title] ??= [ | ||||
|                     'amount'          => '0', | ||||
|                     'currency_symbol' => $currency['currency_symbol'], | ||||
|                     'currency_code'   => $currency['currency_code'], | ||||
| @@ -120,7 +120,7 @@ class DoubleReportController extends Controller | ||||
|             foreach ($currency['transaction_journals'] as $journal) { | ||||
|                 $categoryName             = $journal['category_name'] ?? trans('firefly.no_category'); | ||||
|                 $title                    = sprintf('%s (%s)', $categoryName, $currency['currency_name']); | ||||
|                 $result[$title]           = $result[$title] ?? [ | ||||
|                 $result[$title] ??= [ | ||||
|                     'amount'          => '0', | ||||
|                     'currency_symbol' => $currency['currency_symbol'], | ||||
|                     'currency_code'   => $currency['currency_code'], | ||||
| @@ -155,7 +155,7 @@ class DoubleReportController extends Controller | ||||
|             foreach ($currency['transaction_journals'] as $journal) { | ||||
|                 $categoryName             = $journal['category_name'] ?? trans('firefly.no_category'); | ||||
|                 $title                    = sprintf('%s (%s)', $categoryName, $currency['currency_name']); | ||||
|                 $result[$title]           = $result[$title] ?? [ | ||||
|                 $result[$title] ??= [ | ||||
|                     'amount'          => '0', | ||||
|                     'currency_symbol' => $currency['currency_symbol'], | ||||
|                     'currency_code'   => $currency['currency_code'], | ||||
| @@ -195,7 +195,7 @@ class DoubleReportController extends Controller | ||||
|             $spentKey = sprintf('%d-spent', $currency['currency_id']); | ||||
|             $name     = $this->getCounterpartName($accounts, $account->id, $account->name, $account->iban); | ||||
| 
 | ||||
|             $chartData[$spentKey] = $chartData[$spentKey] ?? [ | ||||
|             $chartData[$spentKey] ??= [ | ||||
|                 'label'           => sprintf( | ||||
|                     '%s (%s)', | ||||
|                     (string)trans('firefly.spent_in_specific_double', ['account' => $name]), | ||||
| @@ -211,7 +211,7 @@ class DoubleReportController extends Controller | ||||
|             foreach ($currency['transaction_journals'] as $journal) { | ||||
|                 $key                                   = $journal['date']->isoFormat($format); | ||||
|                 $amount                                = app('steam')->positive($journal['amount']); | ||||
|                 $chartData[$spentKey]['entries'][$key] = $chartData[$spentKey]['entries'][$key] ?? '0'; | ||||
|                 $chartData[$spentKey]['entries'][$key] ??= '0'; | ||||
|                 $chartData[$spentKey]['entries'][$key] = bcadd($chartData[$spentKey]['entries'][$key], $amount); | ||||
|             } | ||||
|         } | ||||
| @@ -221,7 +221,7 @@ class DoubleReportController extends Controller | ||||
|             $earnedKey = sprintf('%d-earned', $currency['currency_id']); | ||||
|             $name      = $this->getCounterpartName($accounts, $account->id, $account->name, $account->iban); | ||||
| 
 | ||||
|             $chartData[$earnedKey] = $chartData[$earnedKey] ?? [ | ||||
|             $chartData[$earnedKey] ??= [ | ||||
|                 'label'           => sprintf( | ||||
|                     '%s (%s)', | ||||
|                     (string)trans('firefly.earned_in_specific_double', ['account' => $name]), | ||||
| @@ -237,7 +237,7 @@ class DoubleReportController extends Controller | ||||
|             foreach ($currency['transaction_journals'] as $journal) { | ||||
|                 $key                                    = $journal['date']->isoFormat($format); | ||||
|                 $amount                                 = app('steam')->positive($journal['amount']); | ||||
|                 $chartData[$earnedKey]['entries'][$key] = $chartData[$earnedKey]['entries'][$key] ?? '0'; | ||||
|                 $chartData[$earnedKey]['entries'][$key] ??= '0'; | ||||
|                 $chartData[$earnedKey]['entries'][$key] = bcadd($chartData[$earnedKey]['entries'][$key], $amount); | ||||
|             } | ||||
|         } | ||||
| @@ -323,7 +323,7 @@ class DoubleReportController extends Controller | ||||
|                     // do something
 | ||||
|                     $tagName                  = trans('firefly.no_tags'); | ||||
|                     $title                    = sprintf('%s (%s)', $tagName, $currency['currency_name']); | ||||
|                     $result[$title]           = $result[$title] ?? [ | ||||
|                     $result[$title] ??= [ | ||||
|                         'amount'          => '0', | ||||
|                         'currency_symbol' => $currency['currency_symbol'], | ||||
|                         'currency_code'   => $currency['currency_code'], | ||||
| @@ -341,7 +341,7 @@ class DoubleReportController extends Controller | ||||
|                     // do something
 | ||||
|                     $tagName                  = $tag['name']; | ||||
|                     $title                    = sprintf('%s (%s)', $tagName, $currency['currency_name']); | ||||
|                     $result[$title]           = $result[$title] ?? [ | ||||
|                     $result[$title] ??= [ | ||||
|                         'amount'          => '0', | ||||
|                         'currency_symbol' => $currency['currency_symbol'], | ||||
|                         'currency_code'   => $currency['currency_code'], | ||||
| @@ -383,7 +383,7 @@ class DoubleReportController extends Controller | ||||
|                     // do something
 | ||||
|                     $tagName                  = trans('firefly.no_tags'); | ||||
|                     $title                    = sprintf('%s (%s)', $tagName, $currency['currency_name']); | ||||
|                     $result[$title]           = $result[$title] ?? [ | ||||
|                     $result[$title] ??= [ | ||||
|                         'amount'          => '0', | ||||
|                         'currency_symbol' => $currency['currency_symbol'], | ||||
|                         'currency_code'   => $currency['currency_code'], | ||||
| @@ -401,7 +401,7 @@ class DoubleReportController extends Controller | ||||
|                     // do something
 | ||||
|                     $tagName                  = $tag['name']; | ||||
|                     $title                    = sprintf('%s (%s)', $tagName, $currency['currency_name']); | ||||
|                     $result[$title]           = $result[$title] ?? [ | ||||
|                     $result[$title] ??= [ | ||||
|                         'amount'          => '0', | ||||
|                         'currency_symbol' => $currency['currency_symbol'], | ||||
|                         'currency_code'   => $currency['currency_code'], | ||||
|   | ||||
| @@ -166,8 +166,8 @@ class ExpenseReportController extends Controller | ||||
|                 $currentExpense = $expenses[$name] ?? '0'; | ||||
| 
 | ||||
|                 // add to sum:
 | ||||
|                 $sumOfIncome[$exp->id]  = $sumOfIncome[$exp->id] ?? '0'; | ||||
|                 $sumOfExpense[$exp->id] = $sumOfExpense[$exp->id] ?? '0'; | ||||
|                 $sumOfIncome[$exp->id] ??= '0'; | ||||
|                 $sumOfExpense[$exp->id] ??= '0'; | ||||
|                 $sumOfIncome[$exp->id]  = bcadd($sumOfIncome[$exp->id], $currentIncome); | ||||
|                 $sumOfExpense[$exp->id] = bcadd($sumOfExpense[$exp->id], $currentExpense); | ||||
| 
 | ||||
|   | ||||
| @@ -182,14 +182,14 @@ class ReportController extends Controller | ||||
|         foreach ($journals as $journal) { | ||||
|             $period                     = $journal['date']->format($format); | ||||
|             $currencyId                 = (int)$journal['currency_id']; | ||||
|             $data[$currencyId]          = $data[$currencyId] ?? [ | ||||
|             $data[$currencyId] ??= [ | ||||
|                 'currency_id'             => $currencyId, | ||||
|                 'currency_symbol'         => $journal['currency_symbol'], | ||||
|                 'currency_code'           => $journal['currency_code'], | ||||
|                 'currency_name'           => $journal['currency_name'], | ||||
|                 'currency_decimal_places' => (int)$journal['currency_decimal_places'], | ||||
|             ]; | ||||
|             $data[$currencyId][$period] = $data[$currencyId][$period] ?? [ | ||||
|             $data[$currencyId][$period] ??= [ | ||||
|                 'period' => $period, | ||||
|                 'spent'  => '0', | ||||
|                 'earned' => '0', | ||||
|   | ||||
| @@ -87,7 +87,7 @@ class TagReportController extends Controller | ||||
|                 foreach ($tag['transaction_journals'] as $journal) { | ||||
|                     $objectName               = $journal['budget_name'] ?? trans('firefly.no_budget'); | ||||
|                     $title                    = sprintf('%s (%s)', $objectName, $currency['currency_name']); | ||||
|                     $result[$title]           = $result[$title] ?? [ | ||||
|                     $result[$title] ??= [ | ||||
|                         'amount'          => '0', | ||||
|                         'currency_symbol' => $currency['currency_symbol'], | ||||
|                         'currency_code'   => $currency['currency_code'], | ||||
| @@ -123,7 +123,7 @@ class TagReportController extends Controller | ||||
|                 foreach ($tag['transaction_journals'] as $journal) { | ||||
|                     $objectName               = $journal['category_name'] ?? trans('firefly.no_category'); | ||||
|                     $title                    = sprintf('%s (%s)', $objectName, $currency['currency_name']); | ||||
|                     $result[$title]           = $result[$title] ?? [ | ||||
|                     $result[$title] ??= [ | ||||
|                         'amount'          => '0', | ||||
|                         'currency_symbol' => $currency['currency_symbol'], | ||||
|                         'currency_code'   => $currency['currency_code'], | ||||
| @@ -159,7 +159,7 @@ class TagReportController extends Controller | ||||
|                 foreach ($tag['transaction_journals'] as $journal) { | ||||
|                     $objectName               = $journal['category_name'] ?? trans('firefly.no_category'); | ||||
|                     $title                    = sprintf('%s (%s)', $objectName, $currency['currency_name']); | ||||
|                     $result[$title]           = $result[$title] ?? [ | ||||
|                     $result[$title] ??= [ | ||||
|                         'amount'          => '0', | ||||
|                         'currency_symbol' => $currency['currency_symbol'], | ||||
|                         'currency_code'   => $currency['currency_code'], | ||||
| @@ -195,7 +195,7 @@ class TagReportController extends Controller | ||||
|                 foreach ($tag['transaction_journals'] as $journal) { | ||||
|                     $objectName               = $journal['destination_account_name'] ?? trans('firefly.empty'); | ||||
|                     $title                    = sprintf('%s (%s)', $objectName, $currency['currency_name']); | ||||
|                     $result[$title]           = $result[$title] ?? [ | ||||
|                     $result[$title] ??= [ | ||||
|                         'amount'          => '0', | ||||
|                         'currency_symbol' => $currency['currency_symbol'], | ||||
|                         'currency_code'   => $currency['currency_code'], | ||||
| @@ -231,7 +231,7 @@ class TagReportController extends Controller | ||||
|                 foreach ($tag['transaction_journals'] as $journal) { | ||||
|                     $objectName               = $journal['destination_account_name'] ?? trans('firefly.empty'); | ||||
|                     $title                    = sprintf('%s (%s)', $objectName, $currency['currency_name']); | ||||
|                     $result[$title]           = $result[$title] ?? [ | ||||
|                     $result[$title] ??= [ | ||||
|                         'amount'          => '0', | ||||
|                         'currency_symbol' => $currency['currency_symbol'], | ||||
|                         'currency_code'   => $currency['currency_code'], | ||||
| @@ -269,7 +269,7 @@ class TagReportController extends Controller | ||||
|         foreach ($spent as $currency) { | ||||
|             // add things to chart Data for each currency:
 | ||||
|             $spentKey             = sprintf('%d-spent', $currency['currency_id']); | ||||
|             $chartData[$spentKey] = $chartData[$spentKey] ?? [ | ||||
|             $chartData[$spentKey] ??= [ | ||||
|                 'label'           => sprintf( | ||||
|                     '%s (%s)', | ||||
|                     (string)trans('firefly.spent_in_specific_tag', ['tag' => $tag->tag]), | ||||
| @@ -286,7 +286,7 @@ class TagReportController extends Controller | ||||
|                 foreach ($currentTag['transaction_journals'] as $journal) { | ||||
|                     $key                                   = $journal['date']->isoFormat($format); | ||||
|                     $amount                                = app('steam')->positive($journal['amount']); | ||||
|                     $chartData[$spentKey]['entries'][$key] = $chartData[$spentKey]['entries'][$key] ?? '0'; | ||||
|                     $chartData[$spentKey]['entries'][$key] ??= '0'; | ||||
|                     $chartData[$spentKey]['entries'][$key] = bcadd($chartData[$spentKey]['entries'][$key], $amount); | ||||
|                 } | ||||
|             } | ||||
| @@ -296,7 +296,7 @@ class TagReportController extends Controller | ||||
|         foreach ($earned as $currency) { | ||||
|             // add things to chart Data for each currency:
 | ||||
|             $spentKey             = sprintf('%d-earned', $currency['currency_id']); | ||||
|             $chartData[$spentKey] = $chartData[$spentKey] ?? [ | ||||
|             $chartData[$spentKey] ??= [ | ||||
|                 'label'           => sprintf( | ||||
|                     '%s (%s)', | ||||
|                     (string)trans('firefly.earned_in_specific_tag', ['tag' => $tag->tag]), | ||||
| @@ -313,7 +313,7 @@ class TagReportController extends Controller | ||||
|                 foreach ($currentTag['transaction_journals'] as $journal) { | ||||
|                     $key                                   = $journal['date']->isoFormat($format); | ||||
|                     $amount                                = app('steam')->positive($journal['amount']); | ||||
|                     $chartData[$spentKey]['entries'][$key] = $chartData[$spentKey]['entries'][$key] ?? '0'; | ||||
|                     $chartData[$spentKey]['entries'][$key] ??= '0'; | ||||
|                     $chartData[$spentKey]['entries'][$key] = bcadd($chartData[$spentKey]['entries'][$key], $amount); | ||||
|                 } | ||||
|             } | ||||
| @@ -369,7 +369,7 @@ class TagReportController extends Controller | ||||
|                 foreach ($tag['transaction_journals'] as $journal) { | ||||
|                     $objectName               = $journal['source_account_name'] ?? trans('firefly.empty'); | ||||
|                     $title                    = sprintf('%s (%s)', $objectName, $currency['currency_name']); | ||||
|                     $result[$title]           = $result[$title] ?? [ | ||||
|                     $result[$title] ??= [ | ||||
|                         'amount'          => '0', | ||||
|                         'currency_symbol' => $currency['currency_symbol'], | ||||
|                         'currency_code'   => $currency['currency_code'], | ||||
| @@ -405,7 +405,7 @@ class TagReportController extends Controller | ||||
|                 foreach ($tag['transaction_journals'] as $journal) { | ||||
|                     $objectName               = $journal['source_account_name'] ?? trans('firefly.empty'); | ||||
|                     $title                    = sprintf('%s (%s)', $objectName, $currency['currency_name']); | ||||
|                     $result[$title]           = $result[$title] ?? [ | ||||
|                     $result[$title] ??= [ | ||||
|                         'amount'          => '0', | ||||
|                         'currency_symbol' => $currency['currency_symbol'], | ||||
|                         'currency_code'   => $currency['currency_code'], | ||||
| @@ -439,7 +439,7 @@ class TagReportController extends Controller | ||||
|             /** @var array $tag */ | ||||
|             foreach ($currency['tags'] as $tag) { | ||||
|                 $title          = sprintf('%s (%s)', $tag['name'], $currency['currency_name']); | ||||
|                 $result[$title] = $result[$title] ?? [ | ||||
|                 $result[$title] ??= [ | ||||
|                     'amount'          => '0', | ||||
|                     'currency_symbol' => $currency['currency_symbol'], | ||||
|                     'currency_code'   => $currency['currency_code'], | ||||
| @@ -473,7 +473,7 @@ class TagReportController extends Controller | ||||
|             /** @var array $tag */ | ||||
|             foreach ($currency['tags'] as $tag) { | ||||
|                 $title          = sprintf('%s (%s)', $tag['name'], $currency['currency_name']); | ||||
|                 $result[$title] = $result[$title] ?? [ | ||||
|                 $result[$title] ??= [ | ||||
|                     'amount'          => '0', | ||||
|                     'currency_symbol' => $currency['currency_symbol'], | ||||
|                     'currency_code'   => $currency['currency_code'], | ||||
|   | ||||
| @@ -78,7 +78,7 @@ class TransactionController extends Controller | ||||
|         foreach ($result as $journal) { | ||||
|             $budget                 = $journal['budget_name'] ?? (string)trans('firefly.no_budget'); | ||||
|             $title                  = sprintf('%s (%s)', $budget, $journal['currency_symbol']); | ||||
|             $data[$title]           = $data[$title] ?? [ | ||||
|             $data[$title] ??= [ | ||||
|                 'amount'          => '0', | ||||
|                 'currency_symbol' => $journal['currency_symbol'], | ||||
|                 'currency_code'   => $journal['currency_code'], | ||||
| @@ -131,7 +131,7 @@ class TransactionController extends Controller | ||||
|         foreach ($result as $journal) { | ||||
|             $category               = $journal['category_name'] ?? (string)trans('firefly.no_category'); | ||||
|             $title                  = sprintf('%s (%s)', $category, $journal['currency_symbol']); | ||||
|             $data[$title]           = $data[$title] ?? [ | ||||
|             $data[$title] ??= [ | ||||
|                 'amount'          => '0', | ||||
|                 'currency_symbol' => $journal['currency_symbol'], | ||||
|                 'currency_code'   => $journal['currency_code'], | ||||
| @@ -184,7 +184,7 @@ class TransactionController extends Controller | ||||
|         foreach ($result as $journal) { | ||||
|             $name                   = $journal['destination_account_name']; | ||||
|             $title                  = sprintf('%s (%s)', $name, $journal['currency_symbol']); | ||||
|             $data[$title]           = $data[$title] ?? [ | ||||
|             $data[$title] ??= [ | ||||
|                 'amount'          => '0', | ||||
|                 'currency_symbol' => $journal['currency_symbol'], | ||||
|                 'currency_code'   => $journal['currency_code'], | ||||
| @@ -237,7 +237,7 @@ class TransactionController extends Controller | ||||
|         foreach ($result as $journal) { | ||||
|             $name                   = $journal['source_account_name']; | ||||
|             $title                  = sprintf('%s (%s)', $name, $journal['currency_symbol']); | ||||
|             $data[$title]           = $data[$title] ?? [ | ||||
|             $data[$title] ??= [ | ||||
|                 'amount'          => '0', | ||||
|                 'currency_symbol' => $journal['currency_symbol'], | ||||
|                 'currency_code'   => $journal['currency_code'], | ||||
|   | ||||
| @@ -179,9 +179,9 @@ class BoxController extends Controller | ||||
|         foreach ($set as $journal) { | ||||
|             $currencyId           = (int)$journal['currency_id']; | ||||
|             $amount               = $journal['amount'] ?? '0'; | ||||
|             $incomes[$currencyId] = $incomes[$currencyId] ?? '0'; | ||||
|             $incomes[$currencyId] ??= '0'; | ||||
|             $incomes[$currencyId] = bcadd($incomes[$currencyId], app('steam')->positive($amount)); | ||||
|             $sums[$currencyId]    = $sums[$currencyId] ?? '0'; | ||||
|             $sums[$currencyId] ??= '0'; | ||||
|             $sums[$currencyId]    = bcadd($sums[$currencyId], app('steam')->positive($amount)); | ||||
|         } | ||||
| 
 | ||||
| @@ -194,9 +194,9 @@ class BoxController extends Controller | ||||
|         /** @var array $journal */ | ||||
|         foreach ($set as $journal) { | ||||
|             $currencyId            = (int)$journal['currency_id']; | ||||
|             $expenses[$currencyId] = $expenses[$currencyId] ?? '0'; | ||||
|             $expenses[$currencyId] ??= '0'; | ||||
|             $expenses[$currencyId] = bcadd($expenses[$currencyId], $journal['amount'] ?? '0'); | ||||
|             $sums[$currencyId]     = $sums[$currencyId] ?? '0'; | ||||
|             $sums[$currencyId] ??= '0'; | ||||
|             $sums[$currencyId]     = bcadd($sums[$currencyId], $journal['amount']); | ||||
|         } | ||||
| 
 | ||||
|   | ||||
| @@ -46,7 +46,7 @@ class IntroController extends Controller | ||||
|     public function getIntroSteps(string $route, string $specificPage = null): JsonResponse | ||||
|     { | ||||
|         app('log')->debug(sprintf('getIntroSteps for route "%s" and page "%s"', $route, $specificPage)); | ||||
|         $specificPage  = $specificPage ?? ''; | ||||
|         $specificPage ??= ''; | ||||
|         $steps         = $this->getBasicSteps($route); | ||||
|         $specificSteps = $this->getSpecificSteps($route, $specificPage); | ||||
|         if (0 === count($specificSteps)) { | ||||
| @@ -106,7 +106,7 @@ class IntroController extends Controller | ||||
|      */ | ||||
|     public function postEnable(string $route, string $specialPage = null): JsonResponse | ||||
|     { | ||||
|         $specialPage = $specialPage ?? ''; | ||||
|         $specialPage ??= ''; | ||||
|         $route       = str_replace('.', '_', $route); | ||||
|         $key         = 'shown_demo_' . $route; | ||||
|         if ('' !== $specialPage) { | ||||
| @@ -130,7 +130,7 @@ class IntroController extends Controller | ||||
|      */ | ||||
|     public function postFinished(string $route, string $specialPage = null): JsonResponse | ||||
|     { | ||||
|         $specialPage = $specialPage ?? ''; | ||||
|         $specialPage ??= ''; | ||||
|         $key         = 'shown_demo_' . $route; | ||||
|         if ('' !== $specialPage) { | ||||
|             $key .= '_' . $specialPage; | ||||
|   | ||||
| @@ -106,7 +106,7 @@ class IndexController extends Controller | ||||
|             $array      = $transformer->transform($piggy); | ||||
|             $groupOrder = (int)$array['object_group_order']; | ||||
|             // make group array if necessary:
 | ||||
|             $piggyBanks[$groupOrder] = $piggyBanks[$groupOrder] ?? [ | ||||
|             $piggyBanks[$groupOrder] ??= [ | ||||
|                 'object_group_id'    => $array['object_group_id'] ?? 0, | ||||
|                 'object_group_title' => $array['object_group_title'] ?? trans('firefly.default_group_title_name'), | ||||
|                 'piggy_banks'        => [], | ||||
| @@ -154,7 +154,7 @@ class IndexController extends Controller | ||||
|             $groupId = $group['object_group_id']; | ||||
|             foreach ($group['piggy_banks'] as $piggy) { | ||||
|                 $currencyId                  = $piggy['currency_id']; | ||||
|                 $sums[$groupId][$currencyId] = $sums[$groupId][$currencyId] ?? [ | ||||
|                 $sums[$groupId][$currencyId] ??= [ | ||||
|                     'target'                  => '0', | ||||
|                     'saved'                   => '0', | ||||
|                     'left_to_save'            => '0', | ||||
|   | ||||
| @@ -104,7 +104,7 @@ class BalanceController extends Controller | ||||
|             foreach ($journals as $journal) { | ||||
|                 $sourceAccount                  = $journal['source_account_id']; | ||||
|                 $currencyId                     = $journal['currency_id']; | ||||
|                 $spent[$sourceAccount]          = $spent[$sourceAccount] ?? [ | ||||
|                 $spent[$sourceAccount] ??= [ | ||||
|                     'source_account_id'       => $sourceAccount, | ||||
|                     'currency_id'             => $journal['currency_id'], | ||||
|                     'currency_code'           => $journal['currency_code'], | ||||
| @@ -116,7 +116,7 @@ class BalanceController extends Controller | ||||
|                 $spent[$sourceAccount]['spent'] = bcadd($spent[$sourceAccount]['spent'], $journal['amount']); | ||||
| 
 | ||||
|                 // also fix sum:
 | ||||
|                 $report['sums'][$budgetId][$currencyId]        = $report['sums'][$budgetId][$currencyId] ?? [ | ||||
|                 $report['sums'][$budgetId][$currencyId] ??= [ | ||||
|                     'sum'                     => '0', | ||||
|                     'currency_id'             => $journal['currency_id'], | ||||
|                     'currency_code'           => $journal['currency_code'], | ||||
|   | ||||
| @@ -109,7 +109,7 @@ class BudgetController extends Controller | ||||
|         /** @var Account $account */ | ||||
|         foreach ($accounts as $account) { | ||||
|             $accountId          = $account->id; | ||||
|             $report[$accountId] = $report[$accountId] ?? [ | ||||
|             $report[$accountId] ??= [ | ||||
|                 'name'       => $account->name, | ||||
|                 'id'         => $account->id, | ||||
|                 'iban'       => $account->iban, | ||||
| @@ -120,7 +120,7 @@ class BudgetController extends Controller | ||||
|         // loop expenses.
 | ||||
|         foreach ($spent as $currency) { | ||||
|             $currencyId        = $currency['currency_id']; | ||||
|             $sums[$currencyId] = $sums[$currencyId] ?? [ | ||||
|             $sums[$currencyId] ??= [ | ||||
|                 'currency_id'             => $currency['currency_id'], | ||||
|                 'currency_symbol'         => $currency['currency_symbol'], | ||||
|                 'currency_name'           => $currency['currency_name'], | ||||
| @@ -130,7 +130,7 @@ class BudgetController extends Controller | ||||
|             foreach ($currency['budgets'] as $budget) { | ||||
|                 foreach ($budget['transaction_journals'] as $journal) { | ||||
|                     $sourceAccountId                                            = $journal['source_account_id']; | ||||
|                     $report[$sourceAccountId]['currencies'][$currencyId]        = $report[$sourceAccountId]['currencies'][$currencyId] ?? [ | ||||
|                     $report[$sourceAccountId]['currencies'][$currencyId] ??= [ | ||||
|                         'currency_id'             => $currency['currency_id'], | ||||
|                         'currency_symbol'         => $currency['currency_symbol'], | ||||
|                         'currency_name'           => $currency['currency_name'], | ||||
| @@ -167,7 +167,7 @@ class BudgetController extends Controller | ||||
|                 foreach ($budget['transaction_journals'] as $journal) { | ||||
|                     $destinationId = $journal['destination_account_id']; | ||||
|                     $key           = sprintf('%d-%d', $destinationId, $currency['currency_id']); | ||||
|                     $result[$key]  = $result[$key] ?? [ | ||||
|                     $result[$key] ??= [ | ||||
|                         'transactions'             => 0, | ||||
|                         'sum'                      => '0', | ||||
|                         'avg'                      => '0', | ||||
| @@ -219,7 +219,7 @@ class BudgetController extends Controller | ||||
|         /** @var Budget $budget */ | ||||
|         foreach ($budgets as $budget) { | ||||
|             $budgetId          = $budget->id; | ||||
|             $report[$budgetId] = $report[$budgetId] ?? [ | ||||
|             $report[$budgetId] ??= [ | ||||
|                 'name'       => $budget->name, | ||||
|                 'id'         => $budget->id, | ||||
|                 'currencies' => [], | ||||
| @@ -227,7 +227,7 @@ class BudgetController extends Controller | ||||
|         } | ||||
|         foreach ($spent as $currency) { | ||||
|             $currencyId        = $currency['currency_id']; | ||||
|             $sums[$currencyId] = $sums[$currencyId] ?? [ | ||||
|             $sums[$currencyId] ??= [ | ||||
|                 'currency_id'             => $currency['currency_id'], | ||||
|                 'currency_symbol'         => $currency['currency_symbol'], | ||||
|                 'currency_name'           => $currency['currency_name'], | ||||
| @@ -240,7 +240,7 @@ class BudgetController extends Controller | ||||
| 
 | ||||
|                 foreach ($budget['transaction_journals'] as $journal) { | ||||
|                     // add currency info to report array:
 | ||||
|                     $report[$budgetId]['currencies'][$currencyId]        = $report[$budgetId]['currencies'][$currencyId] ?? [ | ||||
|                     $report[$budgetId]['currencies'][$currencyId] ??= [ | ||||
|                         'sum'                     => '0', | ||||
|                         'sum_pct'                 => '0', | ||||
|                         'currency_id'             => $currency['currency_id'], | ||||
| @@ -332,7 +332,7 @@ class BudgetController extends Controller | ||||
|                     $count++; | ||||
|                     $key                               = sprintf('%d-%d', $budget['id'], $currency['currency_id']); | ||||
|                     $dateKey                           = $journal['date']->format($keyFormat); | ||||
|                     $report[$key]                      = $report[$key] ?? [ | ||||
|                     $report[$key] ??= [ | ||||
|                         'id'                      => $budget['id'], | ||||
|                         'name'                    => sprintf('%s (%s)', $budget['name'], $currency['currency_name']), | ||||
|                         'sum'                     => '0', | ||||
| @@ -343,7 +343,7 @@ class BudgetController extends Controller | ||||
|                         'currency_decimal_places' => $currency['currency_decimal_places'], | ||||
|                         'entries'                 => [], | ||||
|                     ]; | ||||
|                     $report[$key]['entries'][$dateKey] = $report[$key] ['entries'][$dateKey] ?? '0'; | ||||
|                     $report[$key]['entries'][$dateKey] ??= '0'; | ||||
|                     $report[$key]['entries'][$dateKey] = bcadd($journal['amount'], $report[$key] ['entries'][$dateKey]); | ||||
|                     $report[$key]['sum']               = bcadd($report[$key] ['sum'], $journal['amount']); | ||||
|                     $report[$key]['avg']               = bcdiv($report[$key]['sum'], (string)count($periods)); | ||||
|   | ||||
| @@ -82,7 +82,7 @@ class CategoryController extends Controller | ||||
|         /** @var Account $account */ | ||||
|         foreach ($accounts as $account) { | ||||
|             $accountId          = $account->id; | ||||
|             $report[$accountId] = $report[$accountId] ?? [ | ||||
|             $report[$accountId] ??= [ | ||||
|                 'name'       => $account->name, | ||||
|                 'id'         => $account->id, | ||||
|                 'iban'       => $account->iban, | ||||
| @@ -98,7 +98,7 @@ class CategoryController extends Controller | ||||
|             foreach ($currency['categories'] as $category) { | ||||
|                 foreach ($category['transaction_journals'] as $journal) { | ||||
|                     $sourceAccountId                                     = $journal['source_account_id']; | ||||
|                     $report[$sourceAccountId]['currencies'][$currencyId] = $report[$sourceAccountId]['currencies'][$currencyId] ?? [ | ||||
|                     $report[$sourceAccountId]['currencies'][$currencyId] ??= [ | ||||
|                         'currency_id'             => $currency['currency_id'], | ||||
|                         'currency_symbol'         => $currency['currency_symbol'], | ||||
|                         'currency_name'           => $currency['currency_name'], | ||||
| @@ -107,8 +107,8 @@ class CategoryController extends Controller | ||||
|                     ]; | ||||
| 
 | ||||
|                     $report[$sourceAccountId]['currencies'][$currencyId]['categories'][$category['id']] | ||||
|                                                                                                                  = $report[$sourceAccountId]['currencies'][$currencyId]['categories'][$category['id']] | ||||
|                                                                                                                    ?? | ||||
|                                                                                                                  ??=  | ||||
|                                                                                                                     | ||||
|                                                                                                                    [ | ||||
|                                                                                                                        'spent'  => '0', | ||||
|                                                                                                                        'earned' => '0', | ||||
| @@ -134,8 +134,8 @@ class CategoryController extends Controller | ||||
|                 foreach ($category['transaction_journals'] as $journal) { | ||||
|                     $destinationId                                                                              = $journal['destination_account_id']; | ||||
|                     $report[$destinationId]['currencies'][$currencyId] | ||||
|                                                                                                                 = $report[$destinationId]['currencies'][$currencyId] | ||||
|                                                                                                                   ?? [ | ||||
|                                                                                                                 ??=  | ||||
|                                                                                                                    [ | ||||
|                                                                                                                       'currency_id'             => $currency['currency_id'], | ||||
|                                                                                                                       'currency_symbol'         => $currency['currency_symbol'], | ||||
|                                                                                                                       'currency_name'           => $currency['currency_name'], | ||||
| @@ -143,8 +143,8 @@ class CategoryController extends Controller | ||||
|                                                                                                                       'categories'              => [], | ||||
|                                                                                                                   ]; | ||||
|                     $report[$destinationId]['currencies'][$currencyId]['categories'][$category['id']] | ||||
|                                                                                                                 = $report[$destinationId]['currencies'][$currencyId]['categories'][$category['id']] | ||||
|                                                                                                                   ?? | ||||
|                                                                                                                 ??=  | ||||
|                                                                                                                    | ||||
|                                                                                                                   [ | ||||
|                                                                                                                       'spent'  => '0', | ||||
|                                                                                                                       'earned' => '0', | ||||
| @@ -182,7 +182,7 @@ class CategoryController extends Controller | ||||
|         /** @var Account $account */ | ||||
|         foreach ($accounts as $account) { | ||||
|             $accountId          = $account->id; | ||||
|             $report[$accountId] = $report[$accountId] ?? [ | ||||
|             $report[$accountId] ??= [ | ||||
|                 'name'       => $account->name, | ||||
|                 'id'         => $account->id, | ||||
|                 'iban'       => $account->iban, | ||||
| @@ -193,7 +193,7 @@ class CategoryController extends Controller | ||||
|         // loop expenses.
 | ||||
|         foreach ($spent as $currency) { | ||||
|             $currencyId        = $currency['currency_id']; | ||||
|             $sums[$currencyId] = $sums[$currencyId] ?? [ | ||||
|             $sums[$currencyId] ??= [ | ||||
|                 'currency_id'             => $currency['currency_id'], | ||||
|                 'currency_symbol'         => $currency['currency_symbol'], | ||||
|                 'currency_name'           => $currency['currency_name'], | ||||
| @@ -205,7 +205,7 @@ class CategoryController extends Controller | ||||
|             foreach ($currency['categories'] as $category) { | ||||
|                 foreach ($category['transaction_journals'] as $journal) { | ||||
|                     $sourceAccountId                                              = $journal['source_account_id']; | ||||
|                     $report[$sourceAccountId]['currencies'][$currencyId]          = $report[$sourceAccountId]['currencies'][$currencyId] ?? [ | ||||
|                     $report[$sourceAccountId]['currencies'][$currencyId] ??= [ | ||||
|                         'currency_id'             => $currency['currency_id'], | ||||
|                         'currency_symbol'         => $currency['currency_symbol'], | ||||
|                         'currency_name'           => $currency['currency_name'], | ||||
| @@ -231,7 +231,7 @@ class CategoryController extends Controller | ||||
|         // loop income.
 | ||||
|         foreach ($earned as $currency) { | ||||
|             $currencyId        = $currency['currency_id']; | ||||
|             $sums[$currencyId] = $sums[$currencyId] ?? [ | ||||
|             $sums[$currencyId] ??= [ | ||||
|                 'currency_id'             => $currency['currency_id'], | ||||
|                 'currency_symbol'         => $currency['currency_symbol'], | ||||
|                 'currency_name'           => $currency['currency_name'], | ||||
| @@ -243,7 +243,7 @@ class CategoryController extends Controller | ||||
|             foreach ($currency['categories'] as $category) { | ||||
|                 foreach ($category['transaction_journals'] as $journal) { | ||||
|                     $destinationAccountId                                               = $journal['destination_account_id']; | ||||
|                     $report[$destinationAccountId]['currencies'][$currencyId]           = $report[$destinationAccountId]['currencies'][$currencyId] ?? [ | ||||
|                     $report[$destinationAccountId]['currencies'][$currencyId] ??= [ | ||||
|                         'currency_id'             => $currency['currency_id'], | ||||
|                         'currency_symbol'         => $currency['currency_symbol'], | ||||
|                         'currency_name'           => $currency['currency_name'], | ||||
| @@ -287,7 +287,7 @@ class CategoryController extends Controller | ||||
|                 foreach ($category['transaction_journals'] as $journal) { | ||||
|                     $destinationId = $journal['destination_account_id']; | ||||
|                     $key           = sprintf('%d-%d', $destinationId, $currency['currency_id']); | ||||
|                     $result[$key]  = $result[$key] ?? [ | ||||
|                     $result[$key] ??= [ | ||||
|                         'transactions'             => 0, | ||||
|                         'sum'                      => '0', | ||||
|                         'avg'                      => '0', | ||||
| @@ -340,7 +340,7 @@ class CategoryController extends Controller | ||||
|                 foreach ($category['transaction_journals'] as $journal) { | ||||
|                     $sourceId     = $journal['source_account_id']; | ||||
|                     $key          = sprintf('%d-%d', $sourceId, $currency['currency_id']); | ||||
|                     $result[$key] = $result[$key] ?? [ | ||||
|                     $result[$key] ??= [ | ||||
|                         'transactions'            => 0, | ||||
|                         'sum'                     => '0', | ||||
|                         'avg'                     => '0', | ||||
| @@ -392,7 +392,7 @@ class CategoryController extends Controller | ||||
|         /** @var Category $category */ | ||||
|         foreach ($categories as $category) { | ||||
|             $categoryId          = $category->id; | ||||
|             $report[$categoryId] = $report[$categoryId] ?? [ | ||||
|             $report[$categoryId] ??= [ | ||||
|                 'name'       => $category->name, | ||||
|                 'id'         => $category->id, | ||||
|                 'currencies' => [], | ||||
| @@ -400,7 +400,7 @@ class CategoryController extends Controller | ||||
|         } | ||||
|         foreach ($spent as $currency) { | ||||
|             $currencyId        = $currency['currency_id']; | ||||
|             $sums[$currencyId] = $sums[$currencyId] ?? [ | ||||
|             $sums[$currencyId] ??= [ | ||||
|                 'currency_id'             => $currency['currency_id'], | ||||
|                 'currency_symbol'         => $currency['currency_symbol'], | ||||
|                 'currency_name'           => $currency['currency_name'], | ||||
| @@ -415,7 +415,7 @@ class CategoryController extends Controller | ||||
| 
 | ||||
|                 foreach ($category['transaction_journals'] as $journal) { | ||||
|                     // add currency info to report array:
 | ||||
|                     $report[$categoryId]['currencies'][$currencyId]          = $report[$categoryId]['currencies'][$currencyId] ?? [ | ||||
|                     $report[$categoryId]['currencies'][$currencyId] ??= [ | ||||
|                         'spent'                   => '0', | ||||
|                         'earned'                  => '0', | ||||
|                         'sum'                     => '0', | ||||
| @@ -441,7 +441,7 @@ class CategoryController extends Controller | ||||
| 
 | ||||
|         foreach ($earned as $currency) { | ||||
|             $currencyId        = $currency['currency_id']; | ||||
|             $sums[$currencyId] = $sums[$currencyId] ?? [ | ||||
|             $sums[$currencyId] ??= [ | ||||
|                 'currency_id'             => $currency['currency_id'], | ||||
|                 'currency_symbol'         => $currency['currency_symbol'], | ||||
|                 'currency_name'           => $currency['currency_name'], | ||||
| @@ -456,7 +456,7 @@ class CategoryController extends Controller | ||||
| 
 | ||||
|                 foreach ($category['transaction_journals'] as $journal) { | ||||
|                     // add currency info to report array:
 | ||||
|                     $report[$categoryId]['currencies'][$currencyId]           = $report[$categoryId]['currencies'][$currencyId] ?? [ | ||||
|                     $report[$categoryId]['currencies'][$currencyId] ??= [ | ||||
|                         'spent'                   => '0', | ||||
|                         'earned'                  => '0', | ||||
|                         'sum'                     => '0', | ||||
| @@ -523,7 +523,7 @@ class CategoryController extends Controller | ||||
|             foreach ($set as $currencyId => $currencyRow) { | ||||
|                 foreach ($currencyRow['categories'] as $categoryId => $categoryRow) { | ||||
|                     $key        = sprintf('%d-%d', $currencyId, $categoryId); | ||||
|                     $data[$key] = $data[$key] ?? [ | ||||
|                     $data[$key] ??= [ | ||||
|                         'id'                      => $categoryRow['id'], | ||||
|                         'title'                   => sprintf('%s (%s)', $categoryRow['name'], $currencyRow['currency_name']), | ||||
|                         'currency_id'             => $currencyRow['currency_id'], | ||||
| @@ -537,7 +537,7 @@ class CategoryController extends Controller | ||||
|                     ]; | ||||
|                     foreach ($categoryRow['transaction_journals'] as $journal) { | ||||
|                         $date                         = $journal['date']->format($format); | ||||
|                         $data[$key]['entries'][$date] = $data[$key]['entries'][$date] ?? '0'; | ||||
|                         $data[$key]['entries'][$date] ??= '0'; | ||||
|                         $data[$key]['entries'][$date] = bcadd($data[$key]['entries'][$date], $journal['amount']); | ||||
|                         $data[$key]['sum']            = bcadd($data[$key]['sum'], $journal['amount']); | ||||
|                     } | ||||
| @@ -604,7 +604,7 @@ class CategoryController extends Controller | ||||
|             foreach ($set as $currencyId => $currencyRow) { | ||||
|                 foreach ($currencyRow['categories'] as $categoryId => $categoryRow) { | ||||
|                     $key        = sprintf('%d-%d', $currencyId, $categoryId); | ||||
|                     $data[$key] = $data[$key] ?? [ | ||||
|                     $data[$key] ??= [ | ||||
|                         'id'                      => $categoryRow['id'], | ||||
|                         'title'                   => sprintf('%s (%s)', $categoryRow['name'], $currencyRow['currency_name']), | ||||
|                         'currency_id'             => $currencyRow['currency_id'], | ||||
| @@ -618,7 +618,7 @@ class CategoryController extends Controller | ||||
|                     ]; | ||||
|                     foreach ($categoryRow['transaction_journals'] as $journal) { | ||||
|                         $date                         = $journal['date']->format($format); | ||||
|                         $data[$key]['entries'][$date] = $data[$key]['entries'][$date] ?? '0'; | ||||
|                         $data[$key]['entries'][$date] ??= '0'; | ||||
|                         $data[$key]['entries'][$date] = bcadd($data[$key]['entries'][$date], $journal['amount']); | ||||
|                         $data[$key]['sum']            = bcadd($data[$key]['sum'], $journal['amount']); | ||||
|                     } | ||||
|   | ||||
| @@ -88,7 +88,7 @@ class DoubleController extends Controller | ||||
|             foreach ($currency['transaction_journals'] as $journal) { | ||||
|                 $sourceId     = $journal['source_account_id']; | ||||
|                 $key          = sprintf('%d-%d', $sourceId, $currency['currency_id']); | ||||
|                 $result[$key] = $result[$key] ?? [ | ||||
|                 $result[$key] ??= [ | ||||
|                     'transactions'            => 0, | ||||
|                     'sum'                     => '0', | ||||
|                     'avg'                     => '0', | ||||
| @@ -141,7 +141,7 @@ class DoubleController extends Controller | ||||
|             foreach ($currency['transaction_journals'] as $journal) { | ||||
|                 $destinationId = $journal['destination_account_id']; | ||||
|                 $key           = sprintf('%d-%d', $destinationId, $currency['currency_id']); | ||||
|                 $result[$key]  = $result[$key] ?? [ | ||||
|                 $result[$key] ??= [ | ||||
|                     'transactions'             => 0, | ||||
|                     'sum'                      => '0', | ||||
|                     'avg'                      => '0', | ||||
| @@ -198,7 +198,7 @@ class DoubleController extends Controller | ||||
|         foreach ($spent as $currency) { | ||||
|             $currencyId = $currency['currency_id']; | ||||
| 
 | ||||
|             $sums[$currencyId] = $sums[$currencyId] ?? [ | ||||
|             $sums[$currencyId] ??= [ | ||||
|                 'spent'                   => '0', | ||||
|                 'earned'                  => '0', | ||||
|                 'sum'                     => '0', | ||||
| @@ -216,7 +216,7 @@ class DoubleController extends Controller | ||||
|                 $destIban            = $journal['destination_account_iban']; | ||||
|                 $genericName         = $this->getCounterpartName($withCounterpart, $destId, $destName, $destIban); | ||||
|                 $objectName          = sprintf('%s (%s)', $genericName, $currency['currency_name']); | ||||
|                 $report[$objectName] = $report[$objectName] ?? [ | ||||
|                 $report[$objectName] ??= [ | ||||
|                     'dest_name'               => '', | ||||
|                     'dest_iban'               => '', | ||||
|                     'source_name'             => '', | ||||
| @@ -246,7 +246,7 @@ class DoubleController extends Controller | ||||
|         foreach ($earned as $currency) { | ||||
|             $currencyId = $currency['currency_id']; | ||||
| 
 | ||||
|             $sums[$currencyId] = $sums[$currencyId] ?? [ | ||||
|             $sums[$currencyId] ??= [ | ||||
|                 'spent'                   => '0', | ||||
|                 'earned'                  => '0', | ||||
|                 'sum'                     => '0', | ||||
| @@ -264,7 +264,7 @@ class DoubleController extends Controller | ||||
|                 $sourceIban          = $journal['source_account_iban']; | ||||
|                 $genericName         = $this->getCounterpartName($withCounterpart, $sourceId, $sourceName, $sourceIban); | ||||
|                 $objectName          = sprintf('%s (%s)', $genericName, $currency['currency_name']); | ||||
|                 $report[$objectName] = $report[$objectName] ?? [ | ||||
|                 $report[$objectName] ??= [ | ||||
|                     'dest_name'               => '', | ||||
|                     'dest_iban'               => '', | ||||
|                     'source_name'             => '', | ||||
| @@ -342,7 +342,7 @@ class DoubleController extends Controller | ||||
|         foreach ($spent as $currency) { | ||||
|             $currencyId = $currency['currency_id']; | ||||
| 
 | ||||
|             $sums[$currencyId] = $sums[$currencyId] ?? [ | ||||
|             $sums[$currencyId] ??= [ | ||||
|                 'spent'                   => '0', | ||||
|                 'earned'                  => '0', | ||||
|                 'sum'                     => '0', | ||||
| @@ -356,7 +356,7 @@ class DoubleController extends Controller | ||||
|             /** @var array $journal */ | ||||
|             foreach ($currency['transaction_journals'] as $journal) { | ||||
|                 $objectName          = sprintf('%s (%s)', $journal['source_account_name'], $currency['currency_name']); | ||||
|                 $report[$objectName] = $report[$objectName] ?? [ | ||||
|                 $report[$objectName] ??= [ | ||||
|                     'account_id'              => $journal['source_account_id'], | ||||
|                     'account_name'            => $objectName, | ||||
|                     'currency_id'             => $currency['currency_id'], | ||||
| @@ -381,7 +381,7 @@ class DoubleController extends Controller | ||||
|         foreach ($earned as $currency) { | ||||
|             $currencyId = $currency['currency_id']; | ||||
| 
 | ||||
|             $sums[$currencyId] = $sums[$currencyId] ?? [ | ||||
|             $sums[$currencyId] ??= [ | ||||
|                 'spent'                   => '0', | ||||
|                 'earned'                  => '0', | ||||
|                 'sum'                     => '0', | ||||
| @@ -395,7 +395,7 @@ class DoubleController extends Controller | ||||
|             /** @var array $journal */ | ||||
|             foreach ($currency['transaction_journals'] as $journal) { | ||||
|                 $objectName          = sprintf('%s (%s)', $journal['destination_account_name'], $currency['currency_name']); | ||||
|                 $report[$objectName] = $report[$objectName] ?? [ | ||||
|                 $report[$objectName] ??= [ | ||||
|                     'account_id'              => $journal['destination_account_id'], | ||||
|                     'account_name'            => $objectName, | ||||
|                     'currency_id'             => $currency['currency_id'], | ||||
|   | ||||
| @@ -162,7 +162,7 @@ class OperationsController extends Controller | ||||
|         /** @var int $currencyId */ | ||||
|         foreach ($keys as $currencyId) { | ||||
|             $currencyInfo             = $incomes['sums'][$currencyId] ?? $expenses['sums'][$currencyId]; | ||||
|             $sums[$currencyId]        = $sums[$currencyId] ?? [ | ||||
|             $sums[$currencyId] ??= [ | ||||
|                 'currency_id'             => $currencyId, | ||||
|                 'currency_name'           => $currencyInfo['currency_name'], | ||||
|                 'currency_code'           => $currencyInfo['currency_code'], | ||||
|   | ||||
| @@ -75,7 +75,7 @@ class TagController extends Controller | ||||
|         /** @var Account $account */ | ||||
|         foreach ($accounts as $account) { | ||||
|             $accountId          = $account->id; | ||||
|             $report[$accountId] = $report[$accountId] ?? [ | ||||
|             $report[$accountId] ??= [ | ||||
|                 'name'       => $account->name, | ||||
|                 'id'         => $account->id, | ||||
|                 'iban'       => $account->iban, | ||||
| @@ -91,7 +91,7 @@ class TagController extends Controller | ||||
|             foreach ($currency['tags'] as $tag) { | ||||
|                 foreach ($tag['transaction_journals'] as $journal) { | ||||
|                     $sourceAccountId                                     = $journal['source_account_id']; | ||||
|                     $report[$sourceAccountId]['currencies'][$currencyId] = $report[$sourceAccountId]['currencies'][$currencyId] ?? [ | ||||
|                     $report[$sourceAccountId]['currencies'][$currencyId] ??= [ | ||||
|                         'currency_id'             => $currency['currency_id'], | ||||
|                         'currency_symbol'         => $currency['currency_symbol'], | ||||
|                         'currency_name'           => $currency['currency_name'], | ||||
| @@ -100,8 +100,8 @@ class TagController extends Controller | ||||
|                     ]; | ||||
| 
 | ||||
|                     $report[$sourceAccountId]['currencies'][$currencyId]['tags'][$tag['id']] | ||||
|                                                                                                       = $report[$sourceAccountId]['currencies'][$currencyId]['tags'][$tag['id']] | ||||
|                                                                                                         ?? | ||||
|                                                                                                       ??=  | ||||
|                                                                                                          | ||||
|                                                                                                         [ | ||||
|                                                                                                             'spent'  => '0', | ||||
|                                                                                                             'earned' => '0', | ||||
| @@ -127,8 +127,8 @@ class TagController extends Controller | ||||
|                 foreach ($tag['transaction_journals'] as $journal) { | ||||
|                     $destinationId                                                                   = $journal['destination_account_id']; | ||||
|                     $report[$destinationId]['currencies'][$currencyId] | ||||
|                                                                                                      = $report[$destinationId]['currencies'][$currencyId] | ||||
|                                                                                                        ?? [ | ||||
|                                                                                                      ??=  | ||||
|                                                                                                         [ | ||||
|                                                                                                            'currency_id'             => $currency['currency_id'], | ||||
|                                                                                                            'currency_symbol'         => $currency['currency_symbol'], | ||||
|                                                                                                            'currency_name'           => $currency['currency_name'], | ||||
| @@ -136,8 +136,8 @@ class TagController extends Controller | ||||
|                                                                                                            'tags'                    => [], | ||||
|                                                                                                        ]; | ||||
|                     $report[$destinationId]['currencies'][$currencyId]['tags'][$tag['id']] | ||||
|                                                                                                      = $report[$destinationId]['currencies'][$currencyId]['tags'][$tag['id']] | ||||
|                                                                                                        ?? | ||||
|                                                                                                      ??=  | ||||
|                                                                                                         | ||||
|                                                                                                        [ | ||||
|                                                                                                            'spent'  => '0', | ||||
|                                                                                                            'earned' => '0', | ||||
| @@ -175,7 +175,7 @@ class TagController extends Controller | ||||
|         /** @var Account $account */ | ||||
|         foreach ($accounts as $account) { | ||||
|             $accountId          = $account->id; | ||||
|             $report[$accountId] = $report[$accountId] ?? [ | ||||
|             $report[$accountId] ??= [ | ||||
|                 'name'       => $account->name, | ||||
|                 'id'         => $account->id, | ||||
|                 'iban'       => $account->iban, | ||||
| @@ -186,7 +186,7 @@ class TagController extends Controller | ||||
|         // loop expenses.
 | ||||
|         foreach ($spent as $currency) { | ||||
|             $currencyId        = $currency['currency_id']; | ||||
|             $sums[$currencyId] = $sums[$currencyId] ?? [ | ||||
|             $sums[$currencyId] ??= [ | ||||
|                 'currency_id'             => $currency['currency_id'], | ||||
|                 'currency_symbol'         => $currency['currency_symbol'], | ||||
|                 'currency_name'           => $currency['currency_name'], | ||||
| @@ -198,7 +198,7 @@ class TagController extends Controller | ||||
|             foreach ($currency['tags'] as $tag) { | ||||
|                 foreach ($tag['transaction_journals'] as $journal) { | ||||
|                     $sourceAccountId                                              = $journal['source_account_id']; | ||||
|                     $report[$sourceAccountId]['currencies'][$currencyId]          = $report[$sourceAccountId]['currencies'][$currencyId] ?? [ | ||||
|                     $report[$sourceAccountId]['currencies'][$currencyId] ??= [ | ||||
|                         'currency_id'             => $currency['currency_id'], | ||||
|                         'currency_symbol'         => $currency['currency_symbol'], | ||||
|                         'currency_name'           => $currency['currency_name'], | ||||
| @@ -224,7 +224,7 @@ class TagController extends Controller | ||||
|         // loop income.
 | ||||
|         foreach ($earned as $currency) { | ||||
|             $currencyId        = $currency['currency_id']; | ||||
|             $sums[$currencyId] = $sums[$currencyId] ?? [ | ||||
|             $sums[$currencyId] ??= [ | ||||
|                 'currency_id'             => $currency['currency_id'], | ||||
|                 'currency_symbol'         => $currency['currency_symbol'], | ||||
|                 'currency_name'           => $currency['currency_name'], | ||||
| @@ -236,7 +236,7 @@ class TagController extends Controller | ||||
|             foreach ($currency['tags'] as $tag) { | ||||
|                 foreach ($tag['transaction_journals'] as $journal) { | ||||
|                     $destinationAccountId                                               = $journal['destination_account_id']; | ||||
|                     $report[$destinationAccountId]['currencies'][$currencyId]           = $report[$destinationAccountId]['currencies'][$currencyId] ?? [ | ||||
|                     $report[$destinationAccountId]['currencies'][$currencyId] ??= [ | ||||
|                         'currency_id'             => $currency['currency_id'], | ||||
|                         'currency_symbol'         => $currency['currency_symbol'], | ||||
|                         'currency_name'           => $currency['currency_name'], | ||||
| @@ -280,7 +280,7 @@ class TagController extends Controller | ||||
|                 foreach ($tag['transaction_journals'] as $journal) { | ||||
|                     $destinationId = $journal['destination_account_id']; | ||||
|                     $key           = sprintf('%d-%d', $destinationId, $currency['currency_id']); | ||||
|                     $result[$key]  = $result[$key] ?? [ | ||||
|                     $result[$key] ??= [ | ||||
|                         'transactions'             => 0, | ||||
|                         'sum'                      => '0', | ||||
|                         'avg'                      => '0', | ||||
| @@ -333,7 +333,7 @@ class TagController extends Controller | ||||
|                 foreach ($tag['transaction_journals'] as $journal) { | ||||
|                     $sourceId     = $journal['source_account_id']; | ||||
|                     $key          = sprintf('%d-%d', $sourceId, $currency['currency_id']); | ||||
|                     $result[$key] = $result[$key] ?? [ | ||||
|                     $result[$key] ??= [ | ||||
|                         'transactions'            => 0, | ||||
|                         'sum'                     => '0', | ||||
|                         'avg'                     => '0', | ||||
| @@ -385,7 +385,7 @@ class TagController extends Controller | ||||
|         /** @var Tag $tag */ | ||||
|         foreach ($tags as $tag) { | ||||
|             $tagId          = $tag->id; | ||||
|             $report[$tagId] = $report[$tagId] ?? [ | ||||
|             $report[$tagId] ??= [ | ||||
|                 'name'       => $tag->tag, | ||||
|                 'id'         => $tag->id, | ||||
|                 'currencies' => [], | ||||
| @@ -393,7 +393,7 @@ class TagController extends Controller | ||||
|         } | ||||
|         foreach ($spent as $currency) { | ||||
|             $currencyId        = $currency['currency_id']; | ||||
|             $sums[$currencyId] = $sums[$currencyId] ?? [ | ||||
|             $sums[$currencyId] ??= [ | ||||
|                 'currency_id'             => $currency['currency_id'], | ||||
|                 'currency_symbol'         => $currency['currency_symbol'], | ||||
|                 'currency_name'           => $currency['currency_name'], | ||||
| @@ -408,7 +408,7 @@ class TagController extends Controller | ||||
| 
 | ||||
|                 foreach ($tag['transaction_journals'] as $journal) { | ||||
|                     // add currency info to report array:
 | ||||
|                     $report[$tagId]['currencies'][$currencyId]          = $report[$tagId]['currencies'][$currencyId] ?? [ | ||||
|                     $report[$tagId]['currencies'][$currencyId] ??= [ | ||||
|                         'spent'                   => '0', | ||||
|                         'earned'                  => '0', | ||||
|                         'sum'                     => '0', | ||||
| @@ -434,7 +434,7 @@ class TagController extends Controller | ||||
| 
 | ||||
|         foreach ($earned as $currency) { | ||||
|             $currencyId        = $currency['currency_id']; | ||||
|             $sums[$currencyId] = $sums[$currencyId] ?? [ | ||||
|             $sums[$currencyId] ??= [ | ||||
|                 'currency_id'             => $currency['currency_id'], | ||||
|                 'currency_symbol'         => $currency['currency_symbol'], | ||||
|                 'currency_name'           => $currency['currency_name'], | ||||
| @@ -449,7 +449,7 @@ class TagController extends Controller | ||||
| 
 | ||||
|                 foreach ($tag['transaction_journals'] as $journal) { | ||||
|                     // add currency info to report array:
 | ||||
|                     $report[$tagId]['currencies'][$currencyId]           = $report[$tagId]['currencies'][$currencyId] ?? [ | ||||
|                     $report[$tagId]['currencies'][$currencyId] ??= [ | ||||
|                         'spent'                   => '0', | ||||
|                         'earned'                  => '0', | ||||
|                         'sum'                     => '0', | ||||
|   | ||||
| @@ -100,7 +100,7 @@ class CreateController extends Controller | ||||
|                 session()->flash('warning', trans('firefly.rule_from_search_words', ['string' => $words])); | ||||
|                 $operators[] = [ | ||||
|                     'type'  => 'description_contains', | ||||
|                     'value' => $words | ||||
|                     'value' => $words, | ||||
|                 ]; | ||||
|             } | ||||
|             $oldTriggers = $this->parseFromOperators($operators); | ||||
|   | ||||
| @@ -243,8 +243,8 @@ class TagController extends Controller | ||||
|         $subTitleIcon = 'fa-tag'; | ||||
|         $page         = (int)$request->get('page'); | ||||
|         $pageSize     = (int)app('preferences')->get('listPageSize', 50)->data; | ||||
|         $start        = $start ?? session('start'); | ||||
|         $end          = $end ?? session('end'); | ||||
|         $start ??= session('start'); | ||||
|         $end ??= session('end'); | ||||
|         $location     = $this->repository->getLocation($tag); | ||||
|         $attachments  = $this->repository->getAttachments($tag); | ||||
|         $subTitle     = trans( | ||||
| @@ -257,7 +257,7 @@ class TagController extends Controller | ||||
|         ); | ||||
| 
 | ||||
|         $startPeriod = $this->repository->firstUseDate($tag); | ||||
|         $startPeriod = $startPeriod ?? today(config('app.timezone')); | ||||
|         $startPeriod ??= today(config('app.timezone')); | ||||
|         $endPeriod   = clone $end; | ||||
|         $periods     = $this->getTagPeriodOverview($tag, $startPeriod, $endPeriod); | ||||
|         $path        = route('tags.show', [$tag->id, $start->format('Y-m-d'), $end->format('Y-m-d')]); | ||||
|   | ||||
| @@ -162,9 +162,9 @@ class ShowController extends Controller | ||||
|             $amounts[$symbol]['amount'] = bcadd($amounts[$symbol]['amount'], $transaction['amount']); | ||||
|             if (null !== $transaction['foreign_amount'] && '' !== $transaction['foreign_amount'] | ||||
|                 && bccomp( | ||||
|                        '0', | ||||
|                        $transaction['foreign_amount'] | ||||
|                    ) !== 0) { | ||||
|                     '0', | ||||
|                     $transaction['foreign_amount'] | ||||
|                 ) !== 0) { | ||||
|                 // same for foreign currency:
 | ||||
|                 $foreignSymbol = $transaction['foreign_currency_symbol']; | ||||
|                 if (!array_key_exists($foreignSymbol, $amounts)) { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user