Code cleanup

This commit is contained in:
James Cole
2024-12-22 08:43:12 +01:00
parent 5751f7e5a3
commit 565bd87959
574 changed files with 4600 additions and 4604 deletions

View File

@@ -109,7 +109,7 @@ class ReportController extends Controller
continue;
}
$currencyId = $netWorthItem['currency_id'];
$label = $current->isoFormat((string)trans('config.month_and_day_js', [], $locale));
$label = $current->isoFormat((string) trans('config.month_and_day_js', [], $locale));
if (!array_key_exists($currencyId, $chartData)) {
$chartData[$currencyId] = [
'label' => 'Net worth in '.$netWorthItem['currency_name'],
@@ -175,13 +175,13 @@ class ReportController extends Controller
/** @var array $journal */
foreach ($journals as $journal) {
$period = $journal['date']->format($format);
$currencyId = (int)$journal['currency_id'];
$currencyId = (int) $journal['currency_id'];
$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'],
'currency_decimal_places' => (int) $journal['currency_decimal_places'],
];
$data[$currencyId][$period] ??= [
'period' => $period,
@@ -198,8 +198,8 @@ class ReportController extends Controller
TransactionTypeEnum::DEPOSIT->value === $journal['transaction_type_type']
|| ((
TransactionTypeEnum::TRANSFER->value === $journal['transaction_type_type']
|| TransactionTypeEnum::RECONCILIATION->value === $journal['transaction_type_type']
|| TransactionTypeEnum::OPENING_BALANCE->value === $journal['transaction_type_type']
|| TransactionTypeEnum::RECONCILIATION->value === $journal['transaction_type_type']
|| TransactionTypeEnum::OPENING_BALANCE->value === $journal['transaction_type_type']
)
&& in_array($journal['destination_account_id'], $ids, true))) {
$key = 'earned';
@@ -214,7 +214,7 @@ class ReportController extends Controller
foreach ($data as $currency) {
Log::debug(sprintf('Now processing currency "%s"', $currency['currency_name']));
$income = [
'label' => (string)trans('firefly.box_earned_in_currency', ['currency' => $currency['currency_name']]),
'label' => (string) trans('firefly.box_earned_in_currency', ['currency' => $currency['currency_name']]),
'type' => 'bar',
'backgroundColor' => 'rgba(0, 141, 76, 0.5)', // green
'currency_id' => $currency['currency_id'],
@@ -223,7 +223,7 @@ class ReportController extends Controller
'entries' => [],
];
$expense = [
'label' => (string)trans('firefly.box_spent_in_currency', ['currency' => $currency['currency_name']]),
'label' => (string) trans('firefly.box_spent_in_currency', ['currency' => $currency['currency_name']]),
'type' => 'bar',
'backgroundColor' => 'rgba(219, 68, 55, 0.5)', // red
'currency_id' => $currency['currency_id'],