Skip to content

Firefly III: a personal finances manager

Clean up code.

James Cole3a083f88b5b2
diff --git a/app/Api/V2/Controllers/Chart/BudgetController.php b/app/Api/V2/Controllers/Chart/BudgetController.php
index dee700c5f9..a62256147b 100644
--- a/app/Api/V2/Controllers/Chart/BudgetController.php
+++ b/app/Api/V2/Controllers/Chart/BudgetController.php
@@ -65,7 +65,7 @@ class BudgetController extends Controller
$this->opsRepository = app(OperationsRepositoryInterface::class);
$this->currency = app('amount')->getDefaultCurrency();
- $userGroup = $this->validateUserGroup($request);
+ $userGroup = $this->validateUserGroup($request);
if (null !== $userGroup) {
$this->repository->setUserGroup($userGroup);
$this->opsRepository->setUserGroup($userGroup);
@@ -77,18 +77,17 @@ class BudgetController extends Controller
}
/**
- * @throws FireflyException
- * TODO see autocomplete/accountcontroller.
+ * TODO see autocomplete/accountcontroller
*/
public function dashboard(DateRequest $request): JsonResponse
{
- $params = $request->getAll();
+ $params = $request->getAll();
/** @var Carbon $start */
- $start = $params['start'];
+ $start = $params['start'];
/** @var Carbon $end */
- $end = $params['end'];
+ $end = $params['end'];
// code from FrontpageChartGenerator, but not in separate class
$budgets = $this->repository->getActiveBudgets();
@@ -209,14 +208,14 @@ class BudgetController extends Controller
'overspent' => '0',
'native_overspent' => '0',
];
- $currentBudgetArray = $block['budgets'][$budgetId];
+ $currentBudgetArray = $block['budgets'][$budgetId];
// var_dump($return);
/** @var array $journal */
foreach ($currentBudgetArray['transaction_journals'] as $journal) {
// convert the amount to the native currency.
- $rate = $converter->getCurrencyRate($this->currencies[$currencyId], $this->currency, $journal['date']);
- $convertedAmount = bcmul($journal['amount'], $rate);
+ $rate = $converter->getCurrencyRate($this->currencies[$currencyId], $this->currency, $journal['date']);
+ $convertedAmount = bcmul($journal['amount'], $rate);
if ($journal['foreign_currency_id'] === $this->currency->id) {
$convertedAmount = $journal['foreign_amount'];
}
@@ -259,7 +258,7 @@ class BudgetController extends Controller
private function processLimit(Budget $budget, BudgetLimit $limit): array
{
Log::debug(sprintf('Created new ExchangeRateConverter in %s', __METHOD__));
- $end = clone $limit->end_date;
+ $end = clone $limit->end_date;
$end->endOfDay();
$spent = $this->opsRepository->listExpenses($limit->start_date, $end, null, new Collection([$budget]));
$limitCurrencyId = $limit->transaction_currency_id;
@@ -277,7 +276,7 @@ class BudgetController extends Controller
$filtered[$currencyId] = $entry;
}
}
- $result = $this->processExpenses($budget->id, $filtered, $limit->start_date, $end);
+ $result = $this->processExpenses($budget->id, $filtered, $limit->start_date, $end);
if (1 === count($result)) {
$compare = bccomp($limit->amount, app('steam')->positive($result[$limitCurrencyId]['spent']));
if (1 === $compare) {
diff --git a/app/Http/Controllers/Recurring/CreateController.php b/app/Http/Controllers/Recurring/CreateController.php
index 1a0f3df91a..dec86505dd 100644
--- a/app/Http/Controllers/Recurring/CreateController.php
+++ b/app/Http/Controllers/Recurring/CreateController.php
@@ -223,6 +223,7 @@ class CreateController extends Controller
public function store(RecurrenceFormRequest $request)
{
$data = $request->getAll();
+
try {
$recurrence = $this->recurring->store($data);
} catch (FireflyException $e) {
diff --git a/app/Http/Controllers/Recurring/EditController.php b/app/Http/Controllers/Recurring/EditController.php
index b53fe6bfed..2b67ed8443 100644
--- a/app/Http/Controllers/Recurring/EditController.php
+++ b/app/Http/Controllers/Recurring/EditController.php
@@ -173,6 +173,7 @@ class EditController extends Controller
$request->session()->flash('success', (string)trans('firefly.updated_recurrence', ['title' => $recurrence->title]));
Log::channel('audit')->info(sprintf('Updated recurrence #%d.', $recurrence->id), $data);
+
// store new attachment(s):
/** @var null|array $files */
$files = $request->hasFile('attachments') ? $request->file('attachments') : null;
diff --git a/app/Support/Twig/General.php b/app/Support/Twig/General.php
index 4a39154899..d95837dc55 100644
--- a/app/Support/Twig/General.php
+++ b/app/Support/Twig/General.php
@@ -347,8 +347,6 @@ class General extends AbstractExtension
/**
* TODO Remove me when v2 hits.
- *
- * @return TwigFunction
*/
protected function getMetaField(): TwigFunction
{
diff --git a/app/Transformers/AccountTransformer.php b/app/Transformers/AccountTransformer.php
index 7d16df3674..264b4d779d 100644
--- a/app/Transformers/AccountTransformer.php
+++ b/app/Transformers/AccountTransformer.php
@@ -200,11 +200,6 @@ class AccountTransformer extends AbstractTransformer
/**
* TODO refactor call to get~OpeningBalanceAmount / Date because it is a lot of queries
- *
- * @param Account $account
- * @param string $accountType
- *
- * @return array
*/
private function getOpeningBalance(Account $account, string $accountType): array
{