Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Automated code cleanup [skip ci]
James Cole13e1292bb7f5
diff --git a/app/Handlers/Events/UpdatedJournalEventHandler.php b/app/Handlers/Events/UpdatedJournalEventHandler.phpindex b6b7a8c8fd..60871ebf08 100644--- a/app/Handlers/Events/UpdatedJournalEventHandler.php+++ b/app/Handlers/Events/UpdatedJournalEventHandler.php@@ -15,11 +15,8 @@ namespace FireflyIII\Handlers\Events;use FireflyIII\Events\UpdatedTransactionJournal;-use FireflyIII\Models\PiggyBankEvent;-use FireflyIII\Models\PiggyBankRepetition;use FireflyIII\Models\Rule;use FireflyIII\Models\RuleGroup;-use FireflyIII\Models\TransactionJournal;use FireflyIII\Rules\Processor;use FireflyIII\Support\Events\BillScanner;diff --git a/app/Helpers/Help/HelpInterface.php b/app/Helpers/Help/HelpInterface.phpindex 7356ba0ba2..4187ddf1ce 100644--- a/app/Helpers/Help/HelpInterface.php+++ b/app/Helpers/Help/HelpInterface.php@@ -49,7 +49,7 @@ interface HelpInterface** @return bool*/- public function inCache(string $route, string $language ): bool;+ public function inCache(string $route, string $language): bool;/*** @param string $routediff --git a/app/Helpers/Report/ReportHelper.php b/app/Helpers/Report/ReportHelper.phpindex 27c76bb3c5..5110e3d6c5 100644--- a/app/Helpers/Report/ReportHelper.php+++ b/app/Helpers/Report/ReportHelper.php@@ -25,7 +25,6 @@ use FireflyIII\Models\Bill;use FireflyIII\Models\Category;use FireflyIII\Models\Tag;use FireflyIII\Models\Transaction;-use FireflyIII\Models\TransactionJournal;use FireflyIII\Repositories\Account\AccountTaskerInterface;use FireflyIII\Repositories\Bill\BillRepositoryInterface;use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;diff --git a/app/Http/Controllers/AccountController.php b/app/Http/Controllers/AccountController.phpindex 5258baa91b..57f532f28f 100644--- a/app/Http/Controllers/AccountController.php+++ b/app/Http/Controllers/AccountController.php@@ -24,7 +24,6 @@ use FireflyIII\Models\Transaction;use FireflyIII\Repositories\Account\AccountRepositoryInterface as ARI;use FireflyIII\Repositories\Account\AccountTaskerInterface;use FireflyIII\Support\CacheProperties;-use Illuminate\Pagination\LengthAwarePaginator;use Illuminate\Support\Collection;use Input;use Navigation;diff --git a/app/Http/Controllers/BillController.php b/app/Http/Controllers/BillController.phpindex e0efc0f812..4cccbdeba3 100644--- a/app/Http/Controllers/BillController.php+++ b/app/Http/Controllers/BillController.php@@ -206,9 +206,9 @@ class BillController extends Controller$overallAverage = $repository->getOverallAverage($bill);// use collector:- $collector = new JournalCollector(auth()->user());+ $collector = new JournalCollector(auth()->user());$collector->setAllAssetAccounts()->setBills(new Collection([$bill]))->setPage($page)->setLimit($pageSize);- $journals = $collector->getPaginatedJournals();+ $journals = $collector->getPaginatedJournals();$journals->setPath('/bills/show/' . $bill->id);$bill->nextExpectedMatch = $repository->nextExpectedMatch($bill, new Carbon);diff --git a/app/Http/Controllers/Controller.php b/app/Http/Controllers/Controller.phpindex 727ef34f7a..6109a79967 100755--- a/app/Http/Controllers/Controller.php+++ b/app/Http/Controllers/Controller.php@@ -13,7 +13,6 @@ declare(strict_types = 1);namespace FireflyIII\Http\Controllers;-use Carbon\Carbon;use Illuminate\Foundation\Auth\Access\AuthorizesRequests;use Illuminate\Foundation\Bus\DispatchesJobs;use Illuminate\Foundation\Validation\ValidatesRequests;diff --git a/app/Http/Controllers/HelpController.php b/app/Http/Controllers/HelpController.phpindex 2d4299818e..24d2d75254 100644--- a/app/Http/Controllers/HelpController.php+++ b/app/Http/Controllers/HelpController.php@@ -42,8 +42,8 @@ class HelpController extends Controllerpublic function show(HelpInterface $help, string $route){- $language = Preferences::get('language', config('firefly.default_language', 'en_US'))->data;- $content = '<p>' . strval(trans('firefly.route_has_no_help')) . '</p>';+ $language = Preferences::get('language', config('firefly.default_language', 'en_US'))->data;+ $content = '<p>' . strval(trans('firefly.route_has_no_help')) . '</p>';if (!$help->hasRoute($route)) {Log::error('No such route: ' . $route);diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.phpindex 8137923969..40872742b5 100644--- a/app/Http/Controllers/HomeController.php+++ b/app/Http/Controllers/HomeController.php@@ -19,7 +19,6 @@ use FireflyIII\Helpers\Collector\JournalCollector;use FireflyIII\Models\AccountType;use FireflyIII\Models\Tag;use FireflyIII\Repositories\Account\AccountRepositoryInterface as ARI;-use FireflyIII\Repositories\Account\AccountTaskerInterface;use FireflyIII\Repositories\Tag\TagRepositoryInterface;use Illuminate\Http\Request;use Illuminate\Support\Collection;@@ -116,7 +115,7 @@ class HomeController extends Controller}/**- * @param ARI $repository+ * @param ARI $repository** @return \Illuminate\Contracts\View\Factory|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|\Illuminate\View\View*/diff --git a/app/Http/Controllers/JsonController.php b/app/Http/Controllers/JsonController.phpindex 197fd7a326..33beceec79 100644--- a/app/Http/Controllers/JsonController.php+++ b/app/Http/Controllers/JsonController.php@@ -21,7 +21,6 @@ use FireflyIII\Repositories\Account\AccountRepositoryInterface;use FireflyIII\Repositories\Account\AccountTaskerInterface;use FireflyIII\Repositories\Bill\BillRepositoryInterface;use FireflyIII\Repositories\Category\CategoryRepositoryInterface as CRI;-use FireflyIII\Repositories\Journal\JournalTaskerInterface;use FireflyIII\Repositories\Tag\TagRepositoryInterface;use FireflyIII\Support\CacheProperties;use Input;@@ -282,7 +281,7 @@ class JsonController extends Controller$types = [$type];// use journal collector instead:- $collector = new JournalCollector(auth()->user());+ $collector = new JournalCollector(auth()->user());$collector->setTypes($types)->setLimit(100)->setPage(1);$journals = $collector->getJournals();foreach ($journals as $j) {diff --git a/app/Http/Controllers/Popup/ReportController.php b/app/Http/Controllers/Popup/ReportController.phpindex 7f0c7d01fa..b31e514853 100644--- a/app/Http/Controllers/Popup/ReportController.php+++ b/app/Http/Controllers/Popup/ReportController.php@@ -23,7 +23,6 @@ use FireflyIII\Models\Transaction;use FireflyIII\Models\TransactionJournal;use FireflyIII\Models\TransactionType;use FireflyIII\Repositories\Account\AccountRepositoryInterface;-use FireflyIII\Repositories\Account\AccountTaskerInterface;use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;use FireflyIII\Repositories\Category\CategoryRepositoryInterface;use FireflyIII\Support\Binder\AccountList;@@ -237,10 +236,10 @@ class ReportController extends Controller$repository = app(AccountRepositoryInterface::class);$account = $repository->find(intval($attributes['accountId']));$types = [TransactionType::DEPOSIT, TransactionType::TRANSFER];- $collector = new JournalCollector(auth()->user());+ $collector = new JournalCollector(auth()->user());$collector->setAccounts(new Collection([$account]))->setRange($attributes['startDate'], $attributes['endDate'])->setTypes($types);$journals = $collector->getJournals();- $report = $attributes['accounts']->pluck('id')->toArray(); // accounts used in this report+ $report = $attributes['accounts']->pluck('id')->toArray(); // accounts used in this report// filter the set so the destinations outside of $attributes['accounts'] are not included.$journals = $journals->filter(diff --git a/app/Http/Controllers/ReportController.php b/app/Http/Controllers/ReportController.phpindex 2f024c88bd..a92648b398 100644--- a/app/Http/Controllers/ReportController.php+++ b/app/Http/Controllers/ReportController.php@@ -21,7 +21,6 @@ use FireflyIII\Models\Account;use FireflyIII\Models\AccountType;use FireflyIII\Models\Transaction;use FireflyIII\Repositories\Account\AccountRepositoryInterface;-use FireflyIII\Repositories\Account\AccountTaskerInterface;use Illuminate\Support\Collection;use Preferences;use Session;diff --git a/app/Http/Controllers/TransactionController.php b/app/Http/Controllers/TransactionController.phpindex 8f443f5950..517ceedd7b 100644--- a/app/Http/Controllers/TransactionController.php+++ b/app/Http/Controllers/TransactionController.php@@ -15,9 +15,7 @@ namespace FireflyIII\Http\Controllers;use Carbon\Carbon;use FireflyIII\Helpers\Collector\JournalCollector;-use FireflyIII\Models\AccountType;use FireflyIII\Models\TransactionJournal;-use FireflyIII\Repositories\Account\AccountRepositoryInterface;use FireflyIII\Repositories\Journal\JournalRepositoryInterface;use FireflyIII\Repositories\Journal\JournalTaskerInterface;use Illuminate\Http\Request;@@ -52,19 +50,19 @@ class TransactionController extends Controller}/**- * @param Request $request- * @param string $what+ * @param Request $request+ * @param string $what** @return View*/public function index(Request $request, string $what){- $pageSize = intval(Preferences::get('transactionPageSize', 50)->data);- $subTitleIcon = config('firefly.transactionIconsByWhat.' . $what);- $types = config('firefly.transactionTypesByWhat.' . $what);- $subTitle = trans('firefly.title_' . $what);- $page = intval($request->get('page'));- $collector = new JournalCollector(auth()->user());+ $pageSize = intval(Preferences::get('transactionPageSize', 50)->data);+ $subTitleIcon = config('firefly.transactionIconsByWhat.' . $what);+ $types = config('firefly.transactionTypesByWhat.' . $what);+ $subTitle = trans('firefly.title_' . $what);+ $page = intval($request->get('page'));+ $collector = new JournalCollector(auth()->user());$collector->setTypes($types)->setLimit($pageSize)->setPage($page)->setAllAssetAccounts();$journals = $collector->getPaginatedJournals();diff --git a/app/Models/Note.php b/app/Models/Note.phpindex c811fcc7cd..17444ba3e7 100644--- a/app/Models/Note.php+++ b/app/Models/Note.php@@ -52,7 +52,8 @@ class Note extends Model*/public function getMarkdownAttribute(): string{- $converter = new CommonMarkConverter;+ $converter = new CommonMarkConverter;+return $converter->convertToHtml($this->text);}diff --git a/app/Models/PiggyBank.php b/app/Models/PiggyBank.phpindex 3d5e5da150..9a57917b26 100644--- a/app/Models/PiggyBank.php+++ b/app/Models/PiggyBank.php@@ -23,22 +23,22 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;/*** FireflyIII\Models\PiggyBank*- * @property integer $id- * @property \Carbon\Carbon $created_at- * @property \Carbon\Carbon $updated_at- * @property \Carbon\Carbon $deleted_at- * @property integer $account_id- * @property string $name- * @property float $targetamount- * @property \Carbon\Carbon $startdate- * @property \Carbon\Carbon $targetdate- * @property integer $order- * @property boolean $encrypted- * @property-read Account $account- * @property-read \Illuminate\Database\Eloquent\Collection|PiggyBankRepetition[] $piggyBankRepetitions- * @property-read \Illuminate\Database\Eloquent\Collection|PiggyBankEvent[] $piggyBankEvents- * @property string $reminder- * @property PiggyBankRepetition $currentRep+ * @property integer $id+ * @property \Carbon\Carbon $created_at+ * @property \Carbon\Carbon $updated_at+ * @property \Carbon\Carbon $deleted_at+ * @property integer $account_id+ * @property string $name+ * @property float $targetamount+ * @property \Carbon\Carbon $startdate+ * @property \Carbon\Carbon $targetdate+ * @property integer $order+ * @property boolean $encrypted+ * @property-read Account $account+ * @property-read \Illuminate\Database\Eloquent\Collection|PiggyBankRepetition[] $piggyBankRepetitions+ * @property-read \Illuminate\Database\Eloquent\Collection|PiggyBankEvent[] $piggyBankEvents+ * @property string $reminder+ * @property PiggyBankRepetition $currentRep* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBank whereId($value)* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBank whereCreatedAt($value)* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBank whereUpdatedAt($value)@@ -54,7 +54,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBank whereDeletedAt($value)* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBank whereEncrypted($value)* @mixin \Eloquent- * @property boolean $active+ * @property boolean $active* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBank whereActive($value)* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Note[] $notes*/diff --git a/app/Repositories/Account/AccountTasker.php b/app/Repositories/Account/AccountTasker.phpindex 8bba27f601..1711fed6bb 100644--- a/app/Repositories/Account/AccountTasker.php+++ b/app/Repositories/Account/AccountTasker.php@@ -257,7 +257,6 @@ class AccountTasker implements AccountTaskerInterface$join->on('transaction_journals.id', '=', 'other_side.transaction_journal_id')->where('other_side.amount', $joinModifier, 0);})-->where('transaction_journals.date', '>=', $start->format('Y-m-d'))->where('transaction_journals.date', '<=', $end->format('Y-m-d'))->where('transaction_journals.user_id', $this->user->id)@@ -313,7 +312,7 @@ class AccountTasker implements AccountTaskerInterface})->leftJoin('accounts as other_account', 'other_account.id', '=', 'other_side.account_id')- ->where('transaction_types.type','!=', TransactionType::OPENING_BALANCE)+ ->where('transaction_types.type', '!=', TransactionType::OPENING_BALANCE)->where('transaction_journals.date', '>=', $start->format('Y-m-d'))->where('transaction_journals.date', '<=', $end->format('Y-m-d'))->where('transaction_journals.user_id', $this->user->id)diff --git a/app/Repositories/Bill/BillRepository.php b/app/Repositories/Bill/BillRepository.phpindex 4a35819c56..e41196b81d 100644--- a/app/Repositories/Bill/BillRepository.php+++ b/app/Repositories/Bill/BillRepository.php@@ -22,7 +22,6 @@ use FireflyIII\Models\TransactionType;use FireflyIII\Support\CacheProperties;use FireflyIII\User;use Illuminate\Database\Query\JoinClause;-use Illuminate\Pagination\LengthAwarePaginator;use Illuminate\Support\Collection;use Log;use Navigation;diff --git a/app/Repositories/Bill/BillRepositoryInterface.php b/app/Repositories/Bill/BillRepositoryInterface.phpindex 16368e53d1..cf71d133bc 100644--- a/app/Repositories/Bill/BillRepositoryInterface.php+++ b/app/Repositories/Bill/BillRepositoryInterface.php@@ -16,7 +16,6 @@ namespace FireflyIII\Repositories\Bill;use Carbon\Carbon;use FireflyIII\Models\Bill;use FireflyIII\Models\TransactionJournal;-use Illuminate\Pagination\LengthAwarePaginator;use Illuminate\Support\Collection;/**diff --git a/app/Repositories/Budget/BudgetRepository.php b/app/Repositories/Budget/BudgetRepository.phpindex 5210d63ec8..b814a8eaf8 100644--- a/app/Repositories/Budget/BudgetRepository.php+++ b/app/Repositories/Budget/BudgetRepository.php@@ -350,8 +350,8 @@ class BudgetRepository implements BudgetRepositoryInterfacepublic function spentInPeriod(Collection $budgets, Collection $accounts, Carbon $start, Carbon $end) : string{// collect amount of transaction journals, which is easy:- $budgetIds = $budgets->pluck('id')->toArray();- $accountIds = $accounts->pluck('id')->toArray();+ $budgetIds = $budgets->pluck('id')->toArray();+ $accountIds = $accounts->pluck('id')->toArray();Log::debug('spentInPeriod: Now in spentInPeriod for these budgets: ', $budgetIds);Log::debug('spentInPeriod: and these accounts: ', $accountIds);diff --git a/app/Repositories/Category/CategoryRepository.php b/app/Repositories/Category/CategoryRepository.phpindex 9004fd682a..cbb2927814 100644--- a/app/Repositories/Category/CategoryRepository.php+++ b/app/Repositories/Category/CategoryRepository.php@@ -20,7 +20,6 @@ use FireflyIII\Models\TransactionType;use FireflyIII\User;use Illuminate\Database\Eloquent\Builder;use Illuminate\Database\Query\JoinClause;-use Illuminate\Pagination\LengthAwarePaginator;use Illuminate\Support\Collection;/**diff --git a/app/Repositories/Category/CategoryRepositoryInterface.php b/app/Repositories/Category/CategoryRepositoryInterface.phpindex b7e2f68e08..d088eebe5d 100644--- a/app/Repositories/Category/CategoryRepositoryInterface.php+++ b/app/Repositories/Category/CategoryRepositoryInterface.php@@ -15,7 +15,6 @@ namespace FireflyIII\Repositories\Category;use Carbon\Carbon;use FireflyIII\Models\Category;-use Illuminate\Pagination\LengthAwarePaginator;use Illuminate\Support\Collection;/**diff --git a/app/Repositories/Journal/JournalRepositoryInterface.php b/app/Repositories/Journal/JournalRepositoryInterface.phpindex d1c2825bb5..06e80fb25b 100644--- a/app/Repositories/Journal/JournalRepositoryInterface.php+++ b/app/Repositories/Journal/JournalRepositoryInterface.php@@ -27,22 +27,22 @@ interface JournalRepositoryInterface{/**- * Deletes a journal.- ** @param TransactionJournal $journal+ * @param TransactionType $type+ * @param array $data*- * @return bool+ * @return MessageBag*/- public function delete(TransactionJournal $journal): bool;+ public function convert(TransactionJournal $journal, TransactionType $type, Account $source, Account $destination): MessageBag;/**+ * Deletes a journal.+ ** @param TransactionJournal $journal- * @param TransactionType $type- * @param array $data*- * @return MessageBag+ * @return bool*/- public function convert(TransactionJournal $journal, TransactionType $type, Account $source, Account $destination): MessageBag;+ public function delete(TransactionJournal $journal): bool;/*** Find a specific journal