Clean up code.

This commit is contained in:
James Cole
2025-05-04 17:41:26 +02:00
parent e28e538272
commit 0573bf2402
147 changed files with 1758 additions and 1770 deletions

View File

@@ -43,16 +43,16 @@ use Illuminate\Support\Collection;
*/
class BudgetReportGenerator
{
private Collection $accounts;
private Collection $accounts;
private readonly BudgetLimitRepositoryInterface $blRepository;
private Collection $budgets;
private TransactionCurrency $currency;
private Carbon $end;
private Collection $budgets;
private TransactionCurrency $currency;
private Carbon $end;
private readonly NoBudgetRepositoryInterface $nbRepository;
private readonly OperationsRepositoryInterface $opsRepository;
private array $report;
private array $report;
private readonly BudgetRepositoryInterface $repository;
private Carbon $start;
private Carbon $start;
/**
* BudgetReportGenerator constructor.
@@ -213,16 +213,16 @@ class BudgetReportGenerator
// make sum information:
$this->report['sums'][$currencyId]
??= [
'budgeted' => '0',
'spent' => '0',
'left' => '0',
'overspent' => '0',
'currency_id' => $currencyId,
'currency_code' => $limitCurrency->code,
'currency_name' => $limitCurrency->name,
'currency_symbol' => $limitCurrency->symbol,
'currency_decimal_places' => $limitCurrency->decimal_places,
];
'budgeted' => '0',
'spent' => '0',
'left' => '0',
'overspent' => '0',
'currency_id' => $currencyId,
'currency_code' => $limitCurrency->code,
'currency_name' => $limitCurrency->name,
'currency_symbol' => $limitCurrency->symbol,
'currency_decimal_places' => $limitCurrency->decimal_places,
];
$this->report['sums'][$currencyId]['budgeted'] = bcadd((string) $this->report['sums'][$currencyId]['budgeted'], $limit->amount);
$this->report['sums'][$currencyId]['spent'] = bcadd((string) $this->report['sums'][$currencyId]['spent'], $spent);
$this->report['sums'][$currencyId]['left'] = bcadd((string) $this->report['sums'][$currencyId]['left'], bcadd($limit->amount, $spent));

View File

@@ -35,12 +35,12 @@ use Illuminate\Support\Collection;
*/
class CategoryReportGenerator
{
private Collection $accounts;
private Carbon $end;
private Collection $accounts;
private Carbon $end;
private readonly NoCategoryRepositoryInterface $noCatRepository;
private readonly OperationsRepositoryInterface $opsRepository;
private array $report;
private Carbon $start;
private array $report;
private Carbon $start;
/**
* CategoryReportGenerator constructor.

View File

@@ -31,9 +31,9 @@ use Illuminate\Support\Facades\Log;
class TransactionSummarizer
{
private User $user;
private TransactionCurrency $default;
private bool $convertToNative = false;
private TransactionCurrency $default;
private User $user;
public function __construct(?User $user = null)
{
@@ -163,9 +163,6 @@ class TransactionSummarizer
$default = Amount::getNativeCurrencyByUserGroup($this->user->userGroup);
Log::debug(sprintf('groupByDirection(array, %s, %s).', $direction, $method));
foreach ($journals as $journal) {
// currency