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:
@@ -40,9 +40,9 @@ class NoBudgetRepository implements NoBudgetRepositoryInterface
|
||||
private $user;
|
||||
|
||||
/**
|
||||
* @param Collection $accounts
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
* @param Collection $accounts
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
@@ -61,19 +61,19 @@ class NoBudgetRepository implements NoBudgetRepositoryInterface
|
||||
|
||||
/** @var array $journal */
|
||||
foreach ($journals as $journal) {
|
||||
$currencyId = (int) $journal['currency_id'];
|
||||
$currencyId = (int)$journal['currency_id'];
|
||||
|
||||
$data[$currencyId] = $data[$currencyId] ?? [
|
||||
'id' => 0,
|
||||
'name' => sprintf('%s (%s)', trans('firefly.no_budget'), $journal['currency_name']),
|
||||
'sum' => '0',
|
||||
'currency_id' => $currencyId,
|
||||
'currency_code' => $journal['currency_code'],
|
||||
'currency_name' => $journal['currency_name'],
|
||||
'currency_symbol' => $journal['currency_symbol'],
|
||||
'currency_decimal_places' => $journal['currency_decimal_places'],
|
||||
'entries' => [],
|
||||
];
|
||||
'id' => 0,
|
||||
'name' => sprintf('%s (%s)', trans('firefly.no_budget'), $journal['currency_name']),
|
||||
'sum' => '0',
|
||||
'currency_id' => $currencyId,
|
||||
'currency_code' => $journal['currency_code'],
|
||||
'currency_name' => $journal['currency_name'],
|
||||
'currency_symbol' => $journal['currency_symbol'],
|
||||
'currency_decimal_places' => $journal['currency_decimal_places'],
|
||||
'entries' => [],
|
||||
];
|
||||
$date = $journal['date']->format($carbonFormat);
|
||||
|
||||
if (!array_key_exists($date, $data[$currencyId]['entries'])) {
|
||||
@@ -86,17 +86,9 @@ class NoBudgetRepository implements NoBudgetRepositoryInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* @param User $user
|
||||
*/
|
||||
public function setUser(User $user): void
|
||||
{
|
||||
$this->user = $user;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Collection $accounts
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
* @param Collection $accounts
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
*
|
||||
* @return array
|
||||
* @deprecated
|
||||
@@ -133,7 +125,7 @@ class NoBudgetRepository implements NoBudgetRepositoryInterface
|
||||
/** @var TransactionCurrency $currency */
|
||||
$currency = $currencies[$code];
|
||||
$return[] = [
|
||||
'currency_id' => (string) $currency['id'],
|
||||
'currency_id' => (string)$currency['id'],
|
||||
'currency_code' => $code,
|
||||
'currency_name' => $currency['name'],
|
||||
'currency_symbol' => $currency['symbol'],
|
||||
@@ -145,14 +137,22 @@ class NoBudgetRepository implements NoBudgetRepositoryInterface
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param User $user
|
||||
*/
|
||||
public function setUser(User $user): void
|
||||
{
|
||||
$this->user = $user;
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO this method does not include multi currency. It just counts.
|
||||
* TODO this probably also applies to the other "sumExpenses" methods.
|
||||
*
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
* @param Collection|null $accounts
|
||||
* @param TransactionCurrency|null $currency
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
* @param Collection|null $accounts
|
||||
* @param TransactionCurrency|null $currency
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
@@ -174,15 +174,15 @@ class NoBudgetRepository implements NoBudgetRepositoryInterface
|
||||
$array = [];
|
||||
|
||||
foreach ($journals as $journal) {
|
||||
$currencyId = (int) $journal['currency_id'];
|
||||
$currencyId = (int)$journal['currency_id'];
|
||||
$array[$currencyId] = $array[$currencyId] ?? [
|
||||
'sum' => '0',
|
||||
'currency_id' => $currencyId,
|
||||
'currency_name' => $journal['currency_name'],
|
||||
'currency_symbol' => $journal['currency_symbol'],
|
||||
'currency_code' => $journal['currency_code'],
|
||||
'currency_decimal_places' => $journal['currency_decimal_places'],
|
||||
];
|
||||
'sum' => '0',
|
||||
'currency_id' => $currencyId,
|
||||
'currency_name' => $journal['currency_name'],
|
||||
'currency_symbol' => $journal['currency_symbol'],
|
||||
'currency_code' => $journal['currency_code'],
|
||||
'currency_decimal_places' => $journal['currency_decimal_places'],
|
||||
];
|
||||
$array[$currencyId]['sum'] = bcadd($array[$currencyId]['sum'], app('steam')->negative($journal['amount']));
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user