mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Various PSR12 code cleanup
This commit is contained in:
@@ -52,8 +52,8 @@ class FrontpageChartGenerator
|
||||
/**
|
||||
* FrontpageChartGenerator constructor.
|
||||
*
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
*/
|
||||
public function __construct(Carbon $start, Carbon $end)
|
||||
{
|
||||
@@ -99,8 +99,8 @@ class FrontpageChartGenerator
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Category $category
|
||||
* @param Collection $accounts
|
||||
* @param Category $category
|
||||
* @param Collection $accounts
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
@@ -113,8 +113,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'],
|
||||
];
|
||||
}
|
||||
|
||||
@@ -122,23 +122,23 @@ class FrontpageChartGenerator
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $currency
|
||||
* @param array $currency
|
||||
*/
|
||||
private function addCurrency(array $currency): void
|
||||
{
|
||||
$currencyId = (int) $currency['currency_id'];
|
||||
$currencyId = (int)$currency['currency_id'];
|
||||
|
||||
$this->currencies[$currencyId] = $this->currencies[$currencyId] ?? [
|
||||
'currency_id' => $currencyId,
|
||||
'currency_name' => $currency['currency_name'],
|
||||
'currency_symbol' => $currency['currency_symbol'],
|
||||
'currency_code' => $currency['currency_code'],
|
||||
'currency_decimal_places' => $currency['currency_decimal_places'],
|
||||
];
|
||||
'currency_id' => $currencyId,
|
||||
'currency_name' => $currency['currency_name'],
|
||||
'currency_symbol' => $currency['currency_symbol'],
|
||||
'currency_code' => $currency['currency_code'],
|
||||
'currency_decimal_places' => $currency['currency_decimal_places'],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Collection $accounts
|
||||
* @param Collection $accounts
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
@@ -151,8 +151,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'],
|
||||
];
|
||||
}
|
||||
|
||||
@@ -160,7 +160,7 @@ class FrontpageChartGenerator
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $data
|
||||
* @param array $data
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
@@ -174,7 +174,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,
|
||||
@@ -185,8 +185,8 @@ class FrontpageChartGenerator
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $currencyData
|
||||
* @param array $monetaryData
|
||||
* @param array $currencyData
|
||||
* @param array $monetaryData
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
|
@@ -36,9 +36,9 @@ use Illuminate\Support\Collection;
|
||||
class WholePeriodChartGenerator
|
||||
{
|
||||
/**
|
||||
* @param Category $category
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
* @param Category $category
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
@@ -77,14 +77,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
|
||||
@@ -117,8 +117,8 @@ class WholePeriodChartGenerator
|
||||
/**
|
||||
* TODO this method is duplicated
|
||||
*
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -143,7 +143,7 @@ class WholePeriodChartGenerator
|
||||
* Loop array of spent/earned info, and extract which currencies are present.
|
||||
* Key is the currency ID.
|
||||
*
|
||||
* @param array $array
|
||||
* @param array $array
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
@@ -153,12 +153,12 @@ class WholePeriodChartGenerator
|
||||
foreach ($array as $block) {
|
||||
foreach ($block as $currencyId => $currencyRow) {
|
||||
$return[$currencyId] = $return[$currencyId] ?? [
|
||||
'currency_id' => $currencyId,
|
||||
'currency_name' => $currencyRow['currency_name'],
|
||||
'currency_symbol' => $currencyRow['currency_symbol'],
|
||||
'currency_code' => $currencyRow['currency_code'],
|
||||
'currency_decimal_places' => $currencyRow['currency_decimal_places'],
|
||||
];
|
||||
'currency_id' => $currencyId,
|
||||
'currency_name' => $currencyRow['currency_name'],
|
||||
'currency_symbol' => $currencyRow['currency_symbol'],
|
||||
'currency_code' => $currencyRow['currency_code'],
|
||||
'currency_decimal_places' => $currencyRow['currency_decimal_places'],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user