Skip to content

Firefly III: a personal finances manager

Various code cleanup [skip ci]

James Cole5d9b68c3e713
diff --git a/app/Generator/Chart/Account/AccountChartGeneratorInterface.php b/app/Generator/Chart/Account/AccountChartGeneratorInterface.php
index 9b90dc6668..0cb57197da 100644
--- a/app/Generator/Chart/Account/AccountChartGeneratorInterface.php
+++ b/app/Generator/Chart/Account/AccountChartGeneratorInterface.php
@@ -31,7 +31,7 @@ interface AccountChartGeneratorInterface
*
* @return array
*/
- public function revenueAccounts(Collection $accounts, Carbon $start, Carbon $end): array;
+ public function expenseAccounts(Collection $accounts, Carbon $start, Carbon $end): array;
/**
* @param Collection $accounts
@@ -40,7 +40,7 @@ interface AccountChartGeneratorInterface
*
* @return array
*/
- public function expenseAccounts(Collection $accounts, Carbon $start, Carbon $end): array;
+ public function frontpage(Collection $accounts, Carbon $start, Carbon $end): array;
/**
* @param Collection $accounts
@@ -49,7 +49,7 @@ interface AccountChartGeneratorInterface
*
* @return array
*/
- public function frontpage(Collection $accounts, Carbon $start, Carbon $end): array;
+ public function revenueAccounts(Collection $accounts, Carbon $start, Carbon $end): array;
/**
* @param Account $account
diff --git a/app/Http/Controllers/AccountController.php b/app/Http/Controllers/AccountController.php
index 23e71d6e4b..bad619e64a 100644
--- a/app/Http/Controllers/AccountController.php
+++ b/app/Http/Controllers/AccountController.php
@@ -114,12 +114,11 @@ class AccountController extends Controller
}
/**
- * @param ARI $repository
* @param Account $account
*
* @return View
*/
- public function edit(ARI $repository, Account $account)
+ public function edit(Account $account)
{
$what = config('firefly.shortNamesByFullName')[$account->accountType->type];
diff --git a/app/Http/Controllers/Admin/UserController.php b/app/Http/Controllers/Admin/UserController.php
index 65f7148c32..dc57328bbd 100644
--- a/app/Http/Controllers/Admin/UserController.php
+++ b/app/Http/Controllers/Admin/UserController.php
@@ -86,10 +86,10 @@ class UserController extends Controller
*/
public function show(UserRepositoryInterface $repository, User $user)
{
- $title = strval(trans('firefly.administration'));
- $mainTitleIcon = 'fa-hand-spock-o';
- $subTitle = strval(trans('firefly.single_user_administration', ['email' => $user->email]));
- $subTitleIcon = 'fa-user';
+ $title = strval(trans('firefly.administration'));
+ $mainTitleIcon = 'fa-hand-spock-o';
+ $subTitle = strval(trans('firefly.single_user_administration', ['email' => $user->email]));
+ $subTitleIcon = 'fa-user';
// get IP info:
$defaultIp = '0.0.0.0';
diff --git a/app/Http/Controllers/Auth/ConfirmationController.php b/app/Http/Controllers/Auth/ConfirmationController.php
index d99662973f..3221971227 100644
--- a/app/Http/Controllers/Auth/ConfirmationController.php
+++ b/app/Http/Controllers/Auth/ConfirmationController.php
@@ -13,8 +13,8 @@ declare(strict_types = 1);
namespace FireflyIII\Http\Controllers\Auth;
-use FireflyIII\Events\ResentConfirmation;
use FireflyIII\Events\ConfirmedUser;
+use FireflyIII\Events\ResentConfirmation;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Http\Controllers\Controller;
use Illuminate\Http\Request;
diff --git a/app/Http/Controllers/Auth/ResetPasswordController.php b/app/Http/Controllers/Auth/ResetPasswordController.php
index e9a3e7b3fc..3e8c162572 100755
--- a/app/Http/Controllers/Auth/ResetPasswordController.php
+++ b/app/Http/Controllers/Auth/ResetPasswordController.php
@@ -41,6 +41,8 @@ class ResetPasswordController extends Controller
*/
public function __construct()
{
+ parent::__construct();
+
$this->middleware('guest');
}
}
diff --git a/app/Http/Controllers/Transaction/SingleController.php b/app/Http/Controllers/Transaction/SingleController.php
index e7efcd63e4..c46d50167b 100644
--- a/app/Http/Controllers/Transaction/SingleController.php
+++ b/app/Http/Controllers/Transaction/SingleController.php
@@ -284,10 +284,11 @@ class SingleController extends Controller
}
/**
- * @param JournalFormRequest $request
- * @param TransactionJournal $journal
+ * @param JournalFormRequest $request
+ * @param JournalRepositoryInterface $repository
+ * @param TransactionJournal $journal
*
- * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
+ * @return $this|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
*/
public function update(JournalFormRequest $request, JournalRepositoryInterface $repository, TransactionJournal $journal)
{
diff --git a/app/Http/Controllers/Transaction/SplitController.php b/app/Http/Controllers/Transaction/SplitController.php
index b849f810ef..e71fe2e60b 100644
--- a/app/Http/Controllers/Transaction/SplitController.php
+++ b/app/Http/Controllers/Transaction/SplitController.php
@@ -126,7 +126,7 @@ class SplitController extends Controller
*/
public function update(Request $request, JournalRepositoryInterface $repository, TransactionJournal $journal)
{
- $data = $this->arrayFromInput($request, $journal);
+ $data = $this->arrayFromInput($request);
$journal = $repository->updateSplitJournal($journal, $data);
// save attachments:
@@ -158,18 +158,17 @@ class SplitController extends Controller
/**
* @param Request $request
- * @param TransactionJournal $journal
*
* @return array
*/
- private function arrayFromInput(Request $request, TransactionJournal $journal): array
+ private function arrayFromInput(Request $request): array
{
$array = [
'journal_description' => $request->get('journal_description'),
'journal_source_account_id' => $request->get('journal_source_account_id'),
'journal_source_account_name' => $request->get('journal_source_account_name'),
'journal_destination_account_id' => $request->get('journal_destination_account_id'),
- 'currency_id' => $request->get('currency_id'),
+ 'currency_id' => $request->get('currency_id'),
'what' => $request->get('what'),
'date' => $request->get('date'),
// all custom fields:
diff --git a/app/Http/Requests/JournalFormRequest.php b/app/Http/Requests/JournalFormRequest.php
index 0076f5e341..289c0b77fa 100644
--- a/app/Http/Requests/JournalFormRequest.php
+++ b/app/Http/Requests/JournalFormRequest.php
@@ -164,63 +164,4 @@ class JournalFormRequest extends Request
{
return $this->get($field) ?? '';
}
- //
- // /**
- // * @param int $index
- // * @param string $field
- // *
- // * @return int
- // */
- // private function getIntFromArray(int $index, string $field): int
- // {
- // $array = $this->get($field);
- // if (isset($array[$index])) {
- // return intval($array[$index]);
- // }
- //
- // return 0;
- // }
- //
- // /**
- // * @param int $index
- // * @param string $field
- // *
- // * @return string
- // */
- // private function getStringFromArray(int $index, string $field): string
- // {
- // $array = $this->get($field);
- // if (isset($array[$index])) {
- // return trim($array[$index]);
- // }
- //
- // return '';
- // }
- //
- // /**
- // * @return array
- // */
- // private function getTransactionData(): array
- // {
- // $transactions = [];
- // $array = $this->get('amount');
- // if (is_array($array) && count($array) > 0) {
- // foreach ($array as $index => $amount) {
- // $transaction = [
- // 'description' => $this->getStringFromArray($index, 'description'),
- // 'amount' => round($amount, 2),
- // 'budget_id' => $this->getIntFromArray($index, 'budget_id'),
- // 'category' => $this->getStringFromArray($index, 'category'),
- // 'source_account_id' => $this->getIntFromArray($index, 'source_account_id'),
- // 'source_account_name' => $this->getStringFromArray($index, 'source_account_name'),
- // 'destination_account_id' => $this->getIntFromArray($index, 'destination_account_id'),
- // 'destination_account_name' => $this->getStringFromArray($index, 'destination_account_name'),
- // 'piggy_bank_id' => $this->getIntFromArray($index, 'piggy_bank_id'),
- // ];
- // $transactions[] = $transaction;
- // }
- // }
- //
- // return $transactions;
- // }
}
diff --git a/app/Repositories/Journal/JournalTasker.php b/app/Repositories/Journal/JournalTasker.php
index cb8fa0a21f..7d9add0dc8 100644
--- a/app/Repositories/Journal/JournalTasker.php
+++ b/app/Repositories/Journal/JournalTasker.php
@@ -159,7 +159,8 @@ class JournalTasker implements JournalTaskerInterface
*
* from transactions as source
*
- * left join transactions as destination ON source.transaction_journal_id = destination.transaction_journal_id AND source.amount = destination.amount * -1 AND source.identifier = destination.identifier
+ * left join transactions as destination ON source.transaction_journal_id =
+ * destination.transaction_journal_id AND source.amount = destination.amount * -1 AND source.identifier = destination.identifier
* -- left join source account name:
* left join accounts as source_accounts ON source.account_id = source_accounts.id
* left join accounts as destination_accounts ON destination.account_id = destination_accounts.id