mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-19 19:01:58 +00:00
Fix phpstan issues.
This commit is contained in:
@@ -31,13 +31,15 @@ class SummaryBalanceGrouped
|
|||||||
{
|
{
|
||||||
private TransactionCurrency $default;
|
private TransactionCurrency $default;
|
||||||
private array $amounts = [];
|
private array $amounts = [];
|
||||||
private array $keys = [];
|
private array $keys;
|
||||||
|
private array $currencies;
|
||||||
private const string SUM = 'sum';
|
private const string SUM = 'sum';
|
||||||
private CurrencyRepositoryInterface $currencyRepository;
|
private CurrencyRepositoryInterface $currencyRepository;
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->keys = [self::SUM];
|
$this->keys = [self::SUM];
|
||||||
|
$this->currencies = [];
|
||||||
$this->currencyRepository = app(CurrencyRepositoryInterface::class);
|
$this->currencyRepository = app(CurrencyRepositoryInterface::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -58,11 +60,11 @@ class SummaryBalanceGrouped
|
|||||||
/** @var array $journal */
|
/** @var array $journal */
|
||||||
foreach ($journals as $journal) {
|
foreach ($journals as $journal) {
|
||||||
// transaction info:
|
// transaction info:
|
||||||
$currencyId = (int)$journal['currency_id'];
|
$currencyId = (int)$journal['currency_id'];
|
||||||
$amount = bcmul($journal['amount'], $multiplier);
|
$amount = bcmul($journal['amount'], $multiplier);
|
||||||
$currency = $currencies[$currencyId] ?? TransactionCurrency::find($currencyId);
|
$currency = $this->currencies[$currencyId] ?? TransactionCurrency::find($currencyId);
|
||||||
$currencies[$currencyId] = $currency;
|
$this->currencies[$currencyId] = $currency;
|
||||||
$nativeAmount = $converter->convert($currency, $this->default, $journal['date'], $amount);
|
$nativeAmount = $converter->convert($currency, $this->default, $journal['date'], $amount);
|
||||||
if ((int)$journal['foreign_currency_id'] === $this->default->id) {
|
if ((int)$journal['foreign_currency_id'] === $this->default->id) {
|
||||||
// use foreign amount instead
|
// use foreign amount instead
|
||||||
$nativeAmount = $journal['foreign_amount'];
|
$nativeAmount = $journal['foreign_amount'];
|
||||||
@@ -115,8 +117,9 @@ class SummaryBalanceGrouped
|
|||||||
// skip native entries.
|
// skip native entries.
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$currency = $currencies[$currencyId] ?? $this->currencyRepository->find($currencyId);
|
$currencyId = (int)$currencyId;
|
||||||
$currencies[$currencyId] = $currency;
|
$currency = $this->currencies[$currencyId] ?? $this->currencyRepository->find($currencyId);
|
||||||
|
$this->currencies[$currencyId] = $currency;
|
||||||
// create objects for big array.
|
// create objects for big array.
|
||||||
foreach ($this->keys as $key) {
|
foreach ($this->keys as $key) {
|
||||||
$title = match ($key) {
|
$title = match ($key) {
|
||||||
|
Reference in New Issue
Block a user