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

@@ -102,8 +102,8 @@ class FrontpageChartGenerator
$tempData[] = [
'name' => $category->name,
'sum' => $currency['sum'],
'sum_float' => round((float)$currency['sum'], $currency['currency_decimal_places']),
'currency_id' => (int)$currency['currency_id'],
'sum_float' => round((float) $currency['sum'], $currency['currency_decimal_places']),
'currency_id' => (int) $currency['currency_id'],
];
}
@@ -112,7 +112,7 @@ class FrontpageChartGenerator
private function addCurrency(array $currency): void
{
$currencyId = (int)$currency['currency_id'];
$currencyId = (int) $currency['currency_id'];
$this->currencies[$currencyId] ??= [
'currency_id' => $currencyId,
@@ -132,8 +132,8 @@ class FrontpageChartGenerator
$tempData[] = [
'name' => trans('firefly.no_category'),
'sum' => $currency['sum'],
'sum_float' => round((float)$currency['sum'], $currency['currency_decimal_places'] ?? 2), // intentional float
'currency_id' => (int)$currency['currency_id'],
'sum_float' => round((float) $currency['sum'], $currency['currency_decimal_places'] ?? 2), // intentional float
'currency_id' => (int) $currency['currency_id'],
];
}
@@ -151,7 +151,7 @@ class FrontpageChartGenerator
foreach ($this->currencies as $currencyId => $currency) {
$key = sprintf('spent-%d', $currencyId);
$return[$key] = [
'label' => sprintf('%s (%s)', (string)trans('firefly.spent'), $currency['currency_name']),
'label' => sprintf('%s (%s)', (string) trans('firefly.spent'), $currency['currency_name']),
'type' => 'bar',
'currency_symbol' => $currency['currency_symbol'],
'entries' => $names,

View File

@@ -71,14 +71,14 @@ class WholePeriodChartGenerator
$code = $currency['currency_code'];
$name = $currency['currency_name'];
$chartData[sprintf('spent-in-%s', $code)] = [
'label' => (string)trans('firefly.box_spent_in_currency', ['currency' => $name]),
'label' => (string) trans('firefly.box_spent_in_currency', ['currency' => $name]),
'entries' => [],
'type' => 'bar',
'backgroundColor' => 'rgba(219, 68, 55, 0.5)', // red
];
$chartData[sprintf('earned-in-%s', $code)] = [
'label' => (string)trans('firefly.box_earned_in_currency', ['currency' => $name]),
'label' => (string) trans('firefly.box_earned_in_currency', ['currency' => $name]),
'entries' => [],
'type' => 'bar',
'backgroundColor' => 'rgba(0, 141, 76, 0.5)', // green