Skip to content

Firefly III: a personal finances manager

Code cleanup.

James Cole73f0cc705ba6
diff --git a/.gitignore b/.gitignore
index 31a213bd48..0e45076d94 100755
--- a/.gitignore
+++ b/.gitignore
@@ -11,3 +11,4 @@ result.html
test-import.sh
test-import-report.txt
public/google*.html
+_ide_helper_models.php
diff --git a/app/Generator/Report/Audit/MonthReportGenerator.php b/app/Generator/Report/Audit/MonthReportGenerator.php
index 3ad211f952..b366042329 100644
--- a/app/Generator/Report/Audit/MonthReportGenerator.php
+++ b/app/Generator/Report/Audit/MonthReportGenerator.php
@@ -118,6 +118,7 @@ class MonthReportGenerator implements ReportGeneratorInterface
*/
public function setCategories(Collection $categories): ReportGeneratorInterface
{
+ return $this;
}
/**
diff --git a/app/Generator/Report/Category/MonthReportGenerator.php b/app/Generator/Report/Category/MonthReportGenerator.php
index 3e0a82ef8c..3211e4f023 100644
--- a/app/Generator/Report/Category/MonthReportGenerator.php
+++ b/app/Generator/Report/Category/MonthReportGenerator.php
@@ -211,6 +211,9 @@ class MonthReportGenerator extends Support implements ReportGeneratorInterface
}
+ /**
+ * @return array
+ */
private function getAverageIncome(): array
{
$expenses = $this->getIncome();
diff --git a/app/Generator/Report/Standard/MonthReportGenerator.php b/app/Generator/Report/Standard/MonthReportGenerator.php
index 4c4ae270f4..fc02233e9c 100644
--- a/app/Generator/Report/Standard/MonthReportGenerator.php
+++ b/app/Generator/Report/Standard/MonthReportGenerator.php
@@ -95,5 +95,6 @@ class MonthReportGenerator implements ReportGeneratorInterface
*/
public function setCategories(Collection $categories): ReportGeneratorInterface
{
+ return $this;
}
}
\ No newline at end of file
diff --git a/app/Generator/Report/Standard/MultiYearReportGenerator.php b/app/Generator/Report/Standard/MultiYearReportGenerator.php
index 8d62c5e85b..64f74f1295 100644
--- a/app/Generator/Report/Standard/MultiYearReportGenerator.php
+++ b/app/Generator/Report/Standard/MultiYearReportGenerator.php
@@ -67,6 +67,7 @@ class MultiYearReportGenerator implements ReportGeneratorInterface
*/
public function setCategories(Collection $categories): ReportGeneratorInterface
{
+ return $this;
}
/**
diff --git a/app/Generator/Report/Standard/YearReportGenerator.php b/app/Generator/Report/Standard/YearReportGenerator.php
index bd356d02cd..7536b4027f 100644
--- a/app/Generator/Report/Standard/YearReportGenerator.php
+++ b/app/Generator/Report/Standard/YearReportGenerator.php
@@ -67,6 +67,7 @@ class YearReportGenerator implements ReportGeneratorInterface
*/
public function setCategories(Collection $categories): ReportGeneratorInterface
{
+ return $this;
}
/**
diff --git a/app/Http/Controllers/Chart/CategoryReportController.php b/app/Http/Controllers/Chart/CategoryReportController.php
index 2aa1fa55f8..6c292609a9 100644
--- a/app/Http/Controllers/Chart/CategoryReportController.php
+++ b/app/Http/Controllers/Chart/CategoryReportController.php
@@ -353,25 +353,6 @@ class CategoryReportController extends Controller
return $set;
}
- /**
- * @param Collection $set
- *
- * @return array
- */
- private function groupByAccount(Collection $set): array
- {
- // group by category ID:
- $grouped = [];
- /** @var Transaction $transaction */
- foreach ($set as $transaction) {
- $accountId = $transaction->account_id;
- $grouped[$accountId] = $grouped[$accountId] ?? '0';
- $grouped[$accountId] = bcadd($transaction->transaction_amount, $grouped[$accountId]);
- }
-
- return $grouped;
- }
-
/**
* @param Collection $set
*
diff --git a/app/Http/Controllers/ReportController.php b/app/Http/Controllers/ReportController.php
index 8d29ba1edf..b980e3337d 100644
--- a/app/Http/Controllers/ReportController.php
+++ b/app/Http/Controllers/ReportController.php
@@ -100,8 +100,9 @@ class ReportController extends Controller
* @param Carbon $end
* @param Collection $accounts
*
+ * @param Collection $categories
+ *
* @return string
- * @throws FireflyException
*/
public function categoryReport(Carbon $start, Carbon $end, Collection $accounts, Collection $categories)
{
diff --git a/app/Http/Controllers/SearchController.php b/app/Http/Controllers/SearchController.php
index e9b63f4b17..4b47777c62 100644
--- a/app/Http/Controllers/SearchController.php
+++ b/app/Http/Controllers/SearchController.php
@@ -35,6 +35,7 @@ class SearchController extends Controller
/**
* Results always come in the form of an array [results, count, fullCount]
*
+ * @param Request $request
* @param SearchInterface $searcher
*
* @return $this
diff --git a/app/Http/Requests/ReportFormRequest.php b/app/Http/Requests/ReportFormRequest.php
index 6219cce4ea..7d97a37b76 100644
--- a/app/Http/Requests/ReportFormRequest.php
+++ b/app/Http/Requests/ReportFormRequest.php
@@ -79,6 +79,10 @@ class ReportFormRequest extends Request
return $collection;
}
+ /**
+ * @return Carbon
+ * @throws FireflyException
+ */
public function getEndDate(): Carbon
{
$date = new Carbon;
diff --git a/app/Models/Account.php b/app/Models/Account.php
index b38d14c2b0..316da495b8 100644
--- a/app/Models/Account.php
+++ b/app/Models/Account.php
@@ -27,6 +27,11 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Watson\Validating\ValidatingTrait;
+/**
+ * Class Account
+ *
+ * @package FireflyIII\Models
+ */
class Account extends Model
{
use SoftDeletes, ValidatingTrait;
diff --git a/app/Models/AccountMeta.php b/app/Models/AccountMeta.php
index 6c92343c18..d8c08233a5 100644
--- a/app/Models/AccountMeta.php
+++ b/app/Models/AccountMeta.php
@@ -16,6 +16,11 @@ namespace FireflyIII\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
+/**
+ * Class AccountMeta
+ *
+ * @package FireflyIII\Models
+ */
class AccountMeta extends Model
{
diff --git a/app/Models/AccountType.php b/app/Models/AccountType.php
index 06a2c37003..0bf346f471 100644
--- a/app/Models/AccountType.php
+++ b/app/Models/AccountType.php
@@ -16,6 +16,11 @@ namespace FireflyIII\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
+/**
+ * Class AccountType
+ *
+ * @package FireflyIII\Models
+ */
class AccountType extends Model
{
const DEFAULT = 'Default account';
diff --git a/app/Models/Attachment.php b/app/Models/Attachment.php
index 6c798372d8..eff2095f78 100644
--- a/app/Models/Attachment.php
+++ b/app/Models/Attachment.php
@@ -20,6 +20,11 @@ use Illuminate\Database\Eloquent\Relations\MorphTo;
use Illuminate\Database\Eloquent\SoftDeletes;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
+/**
+ * Class Attachment
+ *
+ * @package FireflyIII\Models
+ */
class Attachment extends Model
{
use SoftDeletes;
diff --git a/app/Models/Bill.php b/app/Models/Bill.php
index ab9f37e99e..7c6ca35924 100644
--- a/app/Models/Bill.php
+++ b/app/Models/Bill.php
@@ -20,6 +20,11 @@ use Illuminate\Database\Eloquent\Relations\HasMany;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Watson\Validating\ValidatingTrait;
+/**
+ * Class Bill
+ *
+ * @package FireflyIII\Models
+ */
class Bill extends Model
{
diff --git a/app/Models/Budget.php b/app/Models/Budget.php
index ba8cddea4f..c20df153b0 100644
--- a/app/Models/Budget.php
+++ b/app/Models/Budget.php
@@ -20,6 +20,11 @@ use Illuminate\Database\Eloquent\SoftDeletes;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Watson\Validating\ValidatingTrait;
+/**
+ * Class Budget
+ *
+ * @package FireflyIII\Models
+ */
class Budget extends Model
{
diff --git a/app/Models/BudgetLimit.php b/app/Models/BudgetLimit.php
index 9a2843b1b4..86322743bd 100644
--- a/app/Models/BudgetLimit.php
+++ b/app/Models/BudgetLimit.php
@@ -15,6 +15,11 @@ namespace FireflyIII\Models;
use Illuminate\Database\Eloquent\Model;
+/**
+ * Class BudgetLimit
+ *
+ * @package FireflyIII\Models
+ */
class BudgetLimit extends Model
{
diff --git a/app/Models/Category.php b/app/Models/Category.php
index 5b12d93558..e56adb3f2a 100644
--- a/app/Models/Category.php
+++ b/app/Models/Category.php
@@ -20,6 +20,11 @@ use Illuminate\Database\Eloquent\SoftDeletes;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Watson\Validating\ValidatingTrait;
+/**
+ * Class Category
+ *
+ * @package FireflyIII\Models
+ */
class Category extends Model
{
use SoftDeletes, ValidatingTrait;
diff --git a/app/Models/Configuration.php b/app/Models/Configuration.php
index 4b10d83860..9bbee9e894 100644
--- a/app/Models/Configuration.php
+++ b/app/Models/Configuration.php
@@ -16,6 +16,11 @@ namespace FireflyIII\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
+/**
+ * Class Configuration
+ *
+ * @package FireflyIII\Models
+ */
class Configuration extends Model
{
use SoftDeletes;
diff --git a/app/Models/ExportJob.php b/app/Models/ExportJob.php
index 5111f8918d..9a3807c728 100644
--- a/app/Models/ExportJob.php
+++ b/app/Models/ExportJob.php
@@ -16,6 +16,11 @@ namespace FireflyIII\Models;
use Illuminate\Database\Eloquent\Model;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
+/**
+ * Class ExportJob
+ *
+ * @package FireflyIII\Models
+ */
class ExportJob extends Model
{
/**
diff --git a/app/Models/ImportJob.php b/app/Models/ImportJob.php
index 75066b734d..131fc8a1b0 100644
--- a/app/Models/ImportJob.php
+++ b/app/Models/ImportJob.php
@@ -18,6 +18,11 @@ use Illuminate\Database\Eloquent\Model;
use Storage;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
+/**
+ * Class ImportJob
+ *
+ * @package FireflyIII\Models
+ */
class ImportJob extends Model
{
diff --git a/app/Models/LimitRepetition.php b/app/Models/LimitRepetition.php
index 4732b9e950..1ce71bb237 100644
--- a/app/Models/LimitRepetition.php
+++ b/app/Models/LimitRepetition.php
@@ -18,6 +18,11 @@ use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
+/**
+ * Class LimitRepetition
+ *
+ * @package FireflyIII\Models
+ */
class LimitRepetition extends Model
{
diff --git a/app/Models/Note.php b/app/Models/Note.php
index 4b2c3df254..1465008ecf 100644
--- a/app/Models/Note.php
+++ b/app/Models/Note.php
@@ -16,6 +16,11 @@ namespace FireflyIII\Models;
use Illuminate\Database\Eloquent\Model;
use League\CommonMark\CommonMarkConverter;
+/**
+ * Class Note
+ *
+ * @package FireflyIII\Models
+ */
class Note extends Model
{
protected $dates = ['created_at', 'updated_at', 'deleted_at'];
diff --git a/app/Models/PiggyBank.php b/app/Models/PiggyBank.php
index d0c001fb23..2e3f1f01b0 100644
--- a/app/Models/PiggyBank.php
+++ b/app/Models/PiggyBank.php
@@ -20,6 +20,11 @@ use Illuminate\Database\Eloquent\SoftDeletes;
use Steam;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
+/**
+ * Class PiggyBank
+ *
+ * @package FireflyIII\Models
+ */
class PiggyBank extends Model
{
use SoftDeletes;
diff --git a/app/Models/PiggyBankEvent.php b/app/Models/PiggyBankEvent.php
index b8f589b55f..ac11ec0d70 100644
--- a/app/Models/PiggyBankEvent.php
+++ b/app/Models/PiggyBankEvent.php
@@ -15,6 +15,11 @@ namespace FireflyIII\Models;
use Illuminate\Database\Eloquent\Model;
+/**
+ * Class PiggyBankEvent
+ *
+ * @package FireflyIII\Models
+ */
class PiggyBankEvent extends Model
{
diff --git a/app/Models/PiggyBankRepetition.php b/app/Models/PiggyBankRepetition.php
index a6a7ed41b5..cc1432e31b 100644
--- a/app/Models/PiggyBankRepetition.php
+++ b/app/Models/PiggyBankRepetition.php
@@ -17,6 +17,11 @@ use Carbon\Carbon;
use Illuminate\Database\Eloquent\Builder as EloquentBuilder;
use Illuminate\Database\Eloquent\Model;
+/**
+ * Class PiggyBankRepetition
+ *
+ * @package FireflyIII\Models
+ */
class PiggyBankRepetition extends Model
{
diff --git a/app/Models/Preference.php b/app/Models/Preference.php
index 5909ef55aa..768c662f2d 100644
--- a/app/Models/Preference.php
+++ b/app/Models/Preference.php
@@ -19,6 +19,11 @@ use Illuminate\Contracts\Encryption\DecryptException;
use Illuminate\Database\Eloquent\Model;
use Log;
+/**
+ * Class Preference
+ *
+ * @package FireflyIII\Models
+ */
class Preference extends Model
{
diff --git a/app/Models/Role.php b/app/Models/Role.php
index b400b69394..23584fd274 100644
--- a/app/Models/Role.php
+++ b/app/Models/Role.php
@@ -16,6 +16,11 @@ namespace FireflyIII\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
+/**
+ * Class Role
+ *
+ * @package FireflyIII\Models
+ */
class Role extends Model
{
diff --git a/app/Models/Rule.php b/app/Models/Rule.php
index 3e965f1f40..09f8897326 100644
--- a/app/Models/Rule.php
+++ b/app/Models/Rule.php
@@ -17,6 +17,11 @@ use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
+/**
+ * Class Rule
+ *
+ * @package FireflyIII\Models
+ */
class Rule extends Model
{
use SoftDeletes;
diff --git a/app/Models/RuleAction.php b/app/Models/RuleAction.php
index 271aaf1164..11a40ef6a6 100644
--- a/app/Models/RuleAction.php
+++ b/app/Models/RuleAction.php
@@ -22,6 +22,11 @@ namespace FireflyIII\Models;
use Illuminate\Database\Eloquent\Model;
+/**
+ * Class RuleAction
+ *
+ * @package FireflyIII\Models
+ */
class RuleAction extends Model
{
/**
diff --git a/app/Models/RuleGroup.php b/app/Models/RuleGroup.php
index e89a88ee8d..f3dc6abd20 100644
--- a/app/Models/RuleGroup.php
+++ b/app/Models/RuleGroup.php
@@ -17,6 +17,11 @@ use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
+/**
+ * Class RuleGroup
+ *
+ * @package FireflyIII\Models
+ */
class RuleGroup extends Model
{
use SoftDeletes;
diff --git a/app/Models/RuleTrigger.php b/app/Models/RuleTrigger.php
index 399b262c12..72fe0f76a4 100644
--- a/app/Models/RuleTrigger.php
+++ b/app/Models/RuleTrigger.php
@@ -15,6 +15,11 @@ namespace FireflyIII\Models;
use Illuminate\Database\Eloquent\Model;
+/**
+ * Class RuleTrigger
+ *
+ * @package FireflyIII\Models
+ */
class RuleTrigger extends Model
{
/**
diff --git a/app/Models/Tag.php b/app/Models/Tag.php
index d69c13eb68..8106423a33 100644
--- a/app/Models/Tag.php
+++ b/app/Models/Tag.php
@@ -18,6 +18,11 @@ use FireflyIII\Support\Models\TagSupport;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Watson\Validating\ValidatingTrait;
+/**
+ * Class Tag
+ *
+ * @package FireflyIII\Models
+ */
class Tag extends TagSupport
{
protected $dates = ['created_at', 'updated_at', 'date'];
diff --git a/app/Models/Transaction.php b/app/Models/Transaction.php
index 1033611b21..f54d613a29 100644
--- a/app/Models/Transaction.php
+++ b/app/Models/Transaction.php
@@ -19,6 +19,11 @@ use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Watson\Validating\ValidatingTrait;
+/**
+ * Class Transaction
+ *
+ * @package FireflyIII\Models
+ */
class Transaction extends Model
{
diff --git a/app/Models/TransactionCurrency.php b/app/Models/TransactionCurrency.php
index da1c887cad..3e48b6c1d4 100644
--- a/app/Models/TransactionCurrency.php
+++ b/app/Models/TransactionCurrency.php
@@ -18,6 +18,11 @@ use Illuminate\Database\Eloquent\SoftDeletes;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Watson\Validating\ValidatingTrait;
+/**
+ * Class TransactionCurrency
+ *
+ * @package FireflyIII\Models
+ */
class TransactionCurrency extends Model
{
use SoftDeletes, ValidatingTrait;
diff --git a/app/Models/TransactionGroup.php b/app/Models/TransactionGroup.php
index bcef0817e5..46ff2d6e2c 100644
--- a/app/Models/TransactionGroup.php
+++ b/app/Models/TransactionGroup.php
@@ -16,6 +16,11 @@ namespace FireflyIII\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
+/**
+ * Class TransactionGroup
+ *
+ * @package FireflyIII\Models
+ */
class TransactionGroup extends Model
{
use SoftDeletes;
diff --git a/app/Models/TransactionJournal.php b/app/Models/TransactionJournal.php
index e698c0ab15..0441e6e8a0 100644
--- a/app/Models/TransactionJournal.php
+++ b/app/Models/TransactionJournal.php
@@ -25,6 +25,11 @@ use Preferences;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Watson\Validating\ValidatingTrait;
+/**
+ * Class TransactionJournal
+ *
+ * @package FireflyIII\Models
+ */
class TransactionJournal extends TransactionJournalSupport
{
use SoftDeletes, ValidatingTrait;
diff --git a/app/Models/TransactionJournalMeta.php b/app/Models/TransactionJournalMeta.php
index 86653f07fc..9e6ff0ceec 100644
--- a/app/Models/TransactionJournalMeta.php
+++ b/app/Models/TransactionJournalMeta.php
@@ -16,6 +16,11 @@ namespace FireflyIII\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
+/**
+ * Class TransactionJournalMeta
+ *
+ * @package FireflyIII\Models
+ */
class TransactionJournalMeta extends Model
{
diff --git a/app/Models/TransactionType.php b/app/Models/TransactionType.php
index b18b10a7b0..ff685856e7 100644
--- a/app/Models/TransactionType.php
+++ b/app/Models/TransactionType.php
@@ -17,6 +17,11 @@ use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
+/**
+ * Class TransactionType
+ *
+ * @package FireflyIII\Models
+ */
class TransactionType extends Model
{
use SoftDeletes;
diff --git a/app/Repositories/Journal/JournalTasker.php b/app/Repositories/Journal/JournalTasker.php
index 862bafadb8..8cd0c74974 100644
--- a/app/Repositories/Journal/JournalTasker.php
+++ b/app/Repositories/Journal/JournalTasker.php
@@ -13,7 +13,6 @@ declare(strict_types = 1);
namespace FireflyIII\Repositories\Journal;
-use Carbon\Carbon;
use Crypt;
use DB;
use FireflyIII\Models\PiggyBankEvent;
@@ -22,7 +21,6 @@ use FireflyIII\Models\TransactionJournal;
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/Journal/JournalTaskerInterface.php b/app/Repositories/Journal/JournalTaskerInterface.php
index 09ad5813a7..058bc63733 100644
--- a/app/Repositories/Journal/JournalTaskerInterface.php
+++ b/app/Repositories/Journal/JournalTaskerInterface.php
@@ -14,9 +14,7 @@ declare(strict_types = 1);
namespace FireflyIII\Repositories\Journal;
-use Carbon\Carbon;
use FireflyIII\Models\TransactionJournal;
-use Illuminate\Pagination\LengthAwarePaginator;
use Illuminate\Support\Collection;
/**