Skip to content

Firefly III: a personal finances manager

Various code clean up. [skip ci]

James Coled0c6afc3a93a
diff --git a/.gitignore b/.gitignore
index 6f246ed99b..fdc436865e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,4 +6,4 @@ _development
result.html
test-import.sh
test-import-report.txt
-public/google*.html
\ No newline at end of file
+public/google*.html
diff --git a/app/Console/Commands/Import.php b/app/Console/Commands/Import.php
index f1345172b5..44a10acbe4 100644
--- a/app/Console/Commands/Import.php
+++ b/app/Console/Commands/Import.php
@@ -92,6 +92,7 @@ class Import extends Command
$this->error($error);
}
}
+
return;
}
diff --git a/app/Handlers/Events/ConnectTransactionToPiggyBank.php b/app/Handlers/Events/ConnectTransactionToPiggyBank.php
index 17507027b1..c96c9dbfaa 100644
--- a/app/Handlers/Events/ConnectTransactionToPiggyBank.php
+++ b/app/Handlers/Events/ConnectTransactionToPiggyBank.php
@@ -37,7 +37,7 @@ class ConnectTransactionToPiggyBank
$repository = app(PiggyBankRepositoryInterface::class);
$transaction = $event->transaction;
- $piggyBank = $repository->find($transaction['piggy_bank_id']);
+ $piggyBank = $repository->find($transaction['piggy_bank_id']);
// valid piggy:
if (is_null($piggyBank->id)) {
diff --git a/app/Handlers/Events/UserSaveIpAddress.php b/app/Handlers/Events/UserSaveIpAddress.php
index 7dcbf11394..7c9cab2917 100644
--- a/app/Handlers/Events/UserSaveIpAddress.php
+++ b/app/Handlers/Events/UserSaveIpAddress.php
@@ -13,7 +13,6 @@ namespace FireflyIII\Handlers\Events;
use FireflyIII\Events\UserIsConfirmed;
use FireflyIII\Events\UserRegistration;
-use FireflyIII\User;
use Preferences;
/**
@@ -35,13 +34,13 @@ class UserSaveIpAddress
/**
* Handle the event.
*
- * @param UserRegistration $event
+ * @param UserIsConfirmed $event
*
* @return bool
*/
- public function saveFromRegistration(UserRegistration $event): bool
+ public function saveFromConfirmation(UserIsConfirmed $event): bool
{
- Preferences::setForUser($event->user, 'registration_ip_address', $event->ipAddress);
+ Preferences::setForUser($event->user, 'confirmation_ip_address', $event->ipAddress);
return true;
}
@@ -49,13 +48,13 @@ class UserSaveIpAddress
/**
* Handle the event.
*
- * @param UserIsConfirmed $event
+ * @param UserRegistration $event
*
* @return bool
*/
- public function saveFromConfirmation(UserIsConfirmed $event): bool
+ public function saveFromRegistration(UserRegistration $event): bool
{
- Preferences::setForUser($event->user, 'confirmation_ip_address', $event->ipAddress);
+ Preferences::setForUser($event->user, 'registration_ip_address', $event->ipAddress);
return true;
}
diff --git a/app/Helpers/Collection/BalanceLine.php b/app/Helpers/Collection/BalanceLine.php
index 7256f7abe4..905814b011 100644
--- a/app/Helpers/Collection/BalanceLine.php
+++ b/app/Helpers/Collection/BalanceLine.php
@@ -32,14 +32,12 @@ class BalanceLine
/** @var BudgetModel */
protected $budget;
-
- /** @var Carbon */
- protected $startDate;
/** @var Carbon */
protected $endDate;
-
/** @var int */
protected $role = self::ROLE_DEFAULTROLE;
+ /** @var Carbon */
+ protected $startDate;
/**
*
@@ -91,40 +89,35 @@ class BalanceLine
}
/**
- * @return int
+ * @return Carbon
*/
- public function getRole(): int
+ public function getEndDate()
{
- return $this->role;
+ return $this->endDate;
}
/**
- * @param int $role
+ * @param Carbon $endDate
*/
- public function setRole(int $role)
+ public function setEndDate($endDate)
{
- $this->role = $role;
+ $this->endDate = $endDate;
}
/**
- * @return string
+ * @return int
*/
- public function getTitle(): string
+ public function getRole(): int
{
- if ($this->getBudget() instanceof BudgetModel && !is_null($this->getBudget()->id)) {
- return $this->getBudget()->name;
- }
- if ($this->getRole() == self::ROLE_DEFAULTROLE) {
- return trans('firefly.no_budget');
- }
- if ($this->getRole() == self::ROLE_TAGROLE) {
- return trans('firefly.coveredWithTags');
- }
- if ($this->getRole() == self::ROLE_DIFFROLE) {
- return trans('firefly.leftUnbalanced');
- }
+ return $this->role;
+ }
- return '';
+ /**
+ * @param int $role
+ */
+ public function setRole(int $role)
+ {
+ $this->role = $role;
}
/**
@@ -144,22 +137,26 @@ class BalanceLine
}
/**
- * @return Carbon
+ * @return string
*/
- public function getEndDate()
+ public function getTitle(): string
{
- return $this->endDate;
- }
+ if ($this->getBudget() instanceof BudgetModel && !is_null($this->getBudget()->id)) {
+ return $this->getBudget()->name;
+ }
+ if ($this->getRole() == self::ROLE_DEFAULTROLE) {
+ return trans('firefly.no_budget');
+ }
+ if ($this->getRole() == self::ROLE_TAGROLE) {
+ return trans('firefly.coveredWithTags');
+ }
+ if ($this->getRole() == self::ROLE_DIFFROLE) {
+ return trans('firefly.leftUnbalanced');
+ }
- /**
- * @param Carbon $endDate
- */
- public function setEndDate($endDate)
- {
- $this->endDate = $endDate;
+ return '';
}
-
/**
* If a BalanceLine has a budget/repetition, each BalanceEntry in this BalanceLine
* should have a "spent" value, which is the amount of money that has been spent
diff --git a/app/Helpers/Collection/Budget.php b/app/Helpers/Collection/Budget.php
index 174f51f52d..3d7cc056e8 100644
--- a/app/Helpers/Collection/Budget.php
+++ b/app/Helpers/Collection/Budget.php
@@ -47,6 +47,7 @@ class Budget
public function addBudgetLine(BudgetLine $budgetLine): Budget
{
$this->budgetLines->push($budgetLine);
+
return $this;
}
@@ -59,6 +60,7 @@ class Budget
{
$add = strval(round($add, 2));
$this->budgeted = bcadd($this->budgeted, $add);
+
return $this;
}
@@ -71,6 +73,7 @@ class Budget
{
$add = strval(round($add, 2));
$this->left = bcadd($this->left, $add);
+
return $this;
}
@@ -83,6 +86,7 @@ class Budget
{
$add = strval(round($add, 2));
$this->overspent = bcadd($this->overspent, $add);
+
return $this;
}
@@ -95,6 +99,7 @@ class Budget
{
$add = strval(round($add, 2));
$this->spent = bcadd($this->spent, $add);
+
return $this;
}
diff --git a/app/Helpers/Collection/BudgetLine.php b/app/Helpers/Collection/BudgetLine.php
index e7ab113544..710f0cf0a7 100644
--- a/app/Helpers/Collection/BudgetLine.php
+++ b/app/Helpers/Collection/BudgetLine.php
@@ -51,6 +51,7 @@ class BudgetLine
public function setBudget(BudgetModel $budget): BudgetLine
{
$this->budget = $budget;
+
return $this;
}
@@ -70,6 +71,7 @@ class BudgetLine
public function setBudgeted(string $budgeted): BudgetLine
{
$this->budgeted = $budgeted;
+
return $this;
}
@@ -89,6 +91,7 @@ class BudgetLine
public function setLeft(string $left): BudgetLine
{
$this->left = $left;
+
return $this;
}
@@ -108,6 +111,7 @@ class BudgetLine
public function setOverspent(string $overspent): BudgetLine
{
$this->overspent = $overspent;
+
return $this;
}
@@ -127,6 +131,7 @@ class BudgetLine
public function setRepetition(LimitRepetition $repetition): BudgetLine
{
$this->repetition = $repetition;
+
return $this;
}
@@ -146,6 +151,7 @@ class BudgetLine
public function setSpent(string $spent): BudgetLine
{
$this->spent = $spent;
+
return $this;
}
diff --git a/app/Helpers/Csv/Importer.php b/app/Helpers/Csv/Importer.php
index bdf1563709..fab6760b05 100644
--- a/app/Helpers/Csv/Importer.php
+++ b/app/Helpers/Csv/Importer.php
@@ -151,8 +151,8 @@ class Importer
$transactionType = $this->getTransactionType(); // defaults to deposit
$errors = new MessageBag;
-
- $journal = TransactionJournal::create(
+
+ $journal = TransactionJournal::create(
[
'user_id' => Auth::user()->id,
'transaction_type_id' => $transactionType->id,
diff --git a/app/Helpers/Report/BalanceReportHelper.php b/app/Helpers/Report/BalanceReportHelper.php
index 760e2ec167..40cd5d9f0c 100644
--- a/app/Helpers/Report/BalanceReportHelper.php
+++ b/app/Helpers/Report/BalanceReportHelper.php
@@ -262,6 +262,7 @@ class BalanceReportHelper implements BalanceReportHelperInterface
/**
* @param Balance $balance
* @SuppressWarnings(PHPMD.CyclomaticComplexity) // it's exactly 5.
+ *
* @return Balance
*/
private function removeUnusedBudgets(Balance $balance): Balance
diff --git a/app/Http/Controllers/AttachmentController.php b/app/Http/Controllers/AttachmentController.php
index 903b2602e8..73826b72ec 100644
--- a/app/Http/Controllers/AttachmentController.php
+++ b/app/Http/Controllers/AttachmentController.php
@@ -93,10 +93,10 @@ class AttachmentController extends Controller
if ($disk->exists($file)) {
- $quoted = sprintf('"%s"', addcslashes(basename($attachment->filename), '"\\'));
+ $quoted = sprintf('"%s"', addcslashes(basename($attachment->filename), '"\\'));
$content = Crypt::decrypt($disk->get($file));
- Log::debug('Send file to user', ['file' => $quoted, 'size' => strlen($content)]);
+ Log::debug('Send file to user', ['file' => $quoted, 'size' => strlen($content)]);
return response($content, 200)
->header('Content-Description', 'File Transfer')
diff --git a/app/Http/Controllers/ExportController.php b/app/Http/Controllers/ExportController.php
index 265be2f85b..815c54b41c 100644
--- a/app/Http/Controllers/ExportController.php
+++ b/app/Http/Controllers/ExportController.php
@@ -10,7 +10,6 @@
declare(strict_types = 1);
-
namespace FireflyIII\Http\Controllers;
use Carbon\Carbon;
@@ -18,7 +17,6 @@ use ExpandedForm;
use FireflyIII\Crud\Account\AccountCrudInterface;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Export\Processor;
-use FireflyIII\Http\Requests;
use FireflyIII\Http\Requests\ExportFormRequest;
use FireflyIII\Models\AccountType;
use FireflyIII\Models\ExportJob;
diff --git a/app/Http/Controllers/TransactionController.php b/app/Http/Controllers/TransactionController.php
index 054801ddc5..1149949efb 100644
--- a/app/Http/Controllers/TransactionController.php
+++ b/app/Http/Controllers/TransactionController.php
@@ -273,7 +273,7 @@ class TransactionController extends Controller
// store the journal only, flash the rest.
if ($doSplit) {
- $journal = $repository->storeJournal($journalData);
+ $journal = $repository->storeJournal($journalData);
$journal->completed = false;
$journal->save();
diff --git a/app/Import/Converter/BillName.php b/app/Import/Converter/BillName.php
index 2c9eb92f42..9d1095ce12 100644
--- a/app/Import/Converter/BillName.php
+++ b/app/Import/Converter/BillName.php
@@ -36,6 +36,7 @@ class BillName extends BasicConverter implements ConverterInterface
if (strlen($value) === 0) {
$this->setCertainty(0);
+
return new Bill;
}
@@ -48,6 +49,7 @@ class BillName extends BasicConverter implements ConverterInterface
if (!is_null($bill->id)) {
Log::debug('Found bill by ID', ['id' => $bill->id]);
$this->setCertainty(100);
+
return $bill;
}
}
@@ -57,6 +59,7 @@ class BillName extends BasicConverter implements ConverterInterface
if (!is_null($bill->id)) {
Log::debug('Found bill by name ', ['id' => $bill->id]);
$this->setCertainty(100);
+
return $bill;
}
@@ -66,7 +69,7 @@ class BillName extends BasicConverter implements ConverterInterface
'name' => $value,
'match' => $value,
'amount_min' => 1,
- 'user' => $this->user->id,
+ 'user' => $this->user->id,
'amount_max' => 10,
'date' => date('Ymd'),
'repeat_freq' => 'monthly',
diff --git a/app/Import/Converter/BudgetId.php b/app/Import/Converter/BudgetId.php
index aa6448cb89..617bf487fc 100644
--- a/app/Import/Converter/BudgetId.php
+++ b/app/Import/Converter/BudgetId.php
@@ -11,7 +11,6 @@ declare(strict_types = 1);
namespace FireflyIII\Import\Converter;
-use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Models\Budget;
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
use Log;
@@ -36,6 +35,7 @@ class BudgetId extends BasicConverter implements ConverterInterface
if ($value === 0) {
$this->setCertainty(0);
+
return new Budget;
}
@@ -58,6 +58,7 @@ class BudgetId extends BasicConverter implements ConverterInterface
if (!is_null($budget->id)) {
Log::debug('Found budget by ID ', ['id' => $budget->id]);
$this->setCertainty(100);
+
return $budget;
}
diff --git a/app/Import/Converter/BudgetName.php b/app/Import/Converter/BudgetName.php
index 8611e7dd2e..36158c834d 100644
--- a/app/Import/Converter/BudgetName.php
+++ b/app/Import/Converter/BudgetName.php
@@ -11,7 +11,6 @@ declare(strict_types = 1);
namespace FireflyIII\Import\Converter;
-use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Models\Budget;
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
use Log;
@@ -36,6 +35,7 @@ class BudgetName extends BasicConverter implements ConverterInterface
if (strlen($value) === 0) {
$this->setCertainty(0);
+
return new Budget;
}
@@ -48,6 +48,7 @@ class BudgetName extends BasicConverter implements ConverterInterface
if (!is_null($budget->id)) {
Log::debug('Found budget by ID', ['id' => $budget->id]);
$this->setCertainty(100);
+
return $budget;
}
}
@@ -57,14 +58,15 @@ class BudgetName extends BasicConverter implements ConverterInterface
if (!is_null($budget->id)) {
Log::debug('Found budget by name ', ['id' => $budget->id]);
$this->setCertainty(100);
+
return $budget;
}
// create new budget. Use a lot of made up values.
$budget = $repository->store(
[
- 'name' => $value,
- 'user' => $this->user->id,
+ 'name' => $value,
+ 'user' => $this->user->id,
]
);
$this->setCertainty(100);
diff --git a/app/Import/Converter/CategoryId.php b/app/Import/Converter/CategoryId.php
index 47e5d7f965..9f350f3fa6 100644
--- a/app/Import/Converter/CategoryId.php
+++ b/app/Import/Converter/CategoryId.php
@@ -11,7 +11,6 @@ declare(strict_types = 1);
namespace FireflyIII\Import\Converter;
-use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Models\Category;
use FireflyIII\Repositories\Category\CategoryRepositoryInterface;
use Log;
@@ -36,6 +35,7 @@ class CategoryId extends BasicConverter implements ConverterInterface
if ($value === 0) {
$this->setCertainty(0);
+
return new Category;
}
@@ -48,6 +48,7 @@ class CategoryId extends BasicConverter implements ConverterInterface
if (!is_null($category->id)) {
Log::debug('Found category by ID', ['id' => $category->id]);
$this->setCertainty(100);
+
return $category;
}
}
@@ -57,6 +58,7 @@ class CategoryId extends BasicConverter implements ConverterInterface
if (!is_null($category->id)) {
Log::debug('Found category by ID ', ['id' => $category->id]);
$this->setCertainty(100);
+
return $category;
}
diff --git a/app/Import/Converter/CategoryName.php b/app/Import/Converter/CategoryName.php
index 383a1f907d..9b79c33a1e 100644
--- a/app/Import/Converter/CategoryName.php
+++ b/app/Import/Converter/CategoryName.php
@@ -11,7 +11,6 @@ declare(strict_types = 1);
namespace FireflyIII\Import\Converter;
-use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Models\Category;
use FireflyIII\Repositories\Category\CategoryRepositoryInterface;
use Log;
@@ -36,6 +35,7 @@ class CategoryName extends BasicConverter implements ConverterInterface
if (strlen($value) === 0) {
$this->setCertainty(0);
+
return new Category;
}
@@ -48,6 +48,7 @@ class CategoryName extends BasicConverter implements ConverterInterface
if (!is_null($category->id)) {
Log::debug('Found category by ID', ['id' => $category->id]);
$this->setCertainty(100);
+
return $category;
}
}
@@ -57,13 +58,14 @@ class CategoryName extends BasicConverter implements ConverterInterface
if (!is_null($category->id)) {
Log::debug('Found category by name ', ['id' => $category->id]);
$this->setCertainty(100);
+
return $category;
}
// create new category. Use a lot of made up values.
$category = $repository->store(
[
- 'name' => $value,
+ 'name' => $value,
'user' => $this->user->id,
]
);
diff --git a/app/Import/Converter/ConverterInterface.php b/app/Import/Converter/ConverterInterface.php
index e474587a33..8e74c719e3 100644
--- a/app/Import/Converter/ConverterInterface.php
+++ b/app/Import/Converter/ConverterInterface.php
@@ -27,14 +27,14 @@ interface ConverterInterface
public function convert($value);
/**
- * @param array $config
+ * @return int
*/
- public function setConfig(array $config);
+ public function getCertainty(): int;
/**
- * @return int
+ * @param array $config
*/
- public function getCertainty(): int;
+ public function setConfig(array $config);
/**
* @param bool $doMap
diff --git a/app/Import/Converter/CurrencyCode.php b/app/Import/Converter/CurrencyCode.php
index e49bea2e2f..57b7284765 100644
--- a/app/Import/Converter/CurrencyCode.php
+++ b/app/Import/Converter/CurrencyCode.php
@@ -41,6 +41,7 @@ class CurrencyCode extends BasicConverter implements ConverterInterface
if (!is_null($currency->id)) {
Log::debug('Found currency by ID', ['id' => $currency->id]);
$this->setCertainty(100);
+
return $currency;
}
}
@@ -50,6 +51,7 @@ class CurrencyCode extends BasicConverter implements ConverterInterface
if (!is_null($currency->id)) {
Log::debug('Found currency by code', ['id' => $currency->id]);
$this->setCertainty(100);
+
return $currency;
}
$currency = $repository->store(
diff --git a/app/Import/Converter/CurrencyId.php b/app/Import/Converter/CurrencyId.php
index 59b6e2e13f..644ef6ff77 100644
--- a/app/Import/Converter/CurrencyId.php
+++ b/app/Import/Converter/CurrencyId.php
@@ -11,7 +11,6 @@ declare(strict_types = 1);
namespace FireflyIII\Import\Converter;
-use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Models\TransactionCurrency;
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
use Log;
@@ -36,6 +35,7 @@ class CurrencyId extends BasicConverter implements ConverterInterface
if ($value === 0) {
$this->setCertainty(0);
+
return new TransactionCurrency;
}
@@ -48,6 +48,7 @@ class CurrencyId extends BasicConverter implements ConverterInterface
if (!is_null($currency->id)) {
Log::debug('Found currency by ID', ['id' => $currency->id]);
$this->setCertainty(100);
+
return $currency;
}
}
@@ -57,6 +58,7 @@ class CurrencyId extends BasicConverter implements ConverterInterface
if (!is_null($currency->id)) {
Log::debug('Found currency by ID ', ['id' => $currency->id]);
$this->setCertainty(100);
+
return $currency;
}
$this->setCertainty(0);
diff --git a/app/Import/Converter/CurrencyName.php b/app/Import/Converter/CurrencyName.php
index e2976852a5..cb750150ff 100644
--- a/app/Import/Converter/CurrencyName.php
+++ b/app/Import/Converter/CurrencyName.php
@@ -35,6 +35,7 @@ class CurrencyName extends BasicConverter implements ConverterInterface
if (strlen($value) === 0) {
$this->setCertainty(0);
+
return new TransactionCurrency;
}
@@ -47,6 +48,7 @@ class CurrencyName extends BasicConverter implements ConverterInterface
if (!is_null($currency->id)) {
Log::debug('Found currency by ID', ['id' => $currency->id]);
$this->setCertainty(100);
+
return $currency;
}
}
@@ -56,6 +58,7 @@ class CurrencyName extends BasicConverter implements ConverterInterface
if (!is_null($currency->id)) {
Log::debug('Found currency by name ', ['id' => $currency->id]);
$this->setCertainty(100);
+
return $currency;
}
diff --git a/app/Import/Converter/CurrencySymbol.php b/app/Import/Converter/CurrencySymbol.php
index 2855f2bd48..7643087a0a 100644
--- a/app/Import/Converter/CurrencySymbol.php
+++ b/app/Import/Converter/CurrencySymbol.php
@@ -35,6 +35,7 @@ class CurrencySymbol extends BasicConverter implements ConverterInterface
if (strlen($value) === 0) {
$this->setCertainty(0);
+
return new TransactionCurrency;
}
@@ -47,6 +48,7 @@ class CurrencySymbol extends BasicConverter implements ConverterInterface
if (!is_null($currency->id)) {
Log::debug('Found currency by ID', ['id' => $currency->id]);
$this->setCertainty(100);
+
return $currency;
}
}
@@ -56,6 +58,7 @@ class CurrencySymbol extends BasicConverter implements ConverterInterface
if (!is_null($currency->id)) {
Log::debug('Found currency by symbol ', ['id' => $currency->id]);
$this->setCertainty(100);
+
return $currency;
}
diff --git a/app/Import/Converter/Date.php b/app/Import/Converter/Date.php
index 1ffe496b78..4cc9808291 100644
--- a/app/Import/Converter/Date.php
+++ b/app/Import/Converter/Date.php
@@ -40,10 +40,12 @@ class Date extends BasicConverter implements ConverterInterface
Log::info($e->getMessage());
Log::info('Cannot convert this string using the given format.', ['value' => $value, 'format' => $this->config['date-format']]);
$this->setCertainty(0);
+
return new Carbon;
}
Log::debug('Converted date', ['converted' => $date->toAtomString()]);
$this->setCertainty(100);
+
return $date;
}
}
diff --git a/app/Import/Converter/INGDebetCredit.php b/app/Import/Converter/INGDebetCredit.php
index 2e3ca15dbd..b023e4c09d 100644
--- a/app/Import/Converter/INGDebetCredit.php
+++ b/app/Import/Converter/INGDebetCredit.php
@@ -11,7 +11,6 @@ declare(strict_types = 1);
namespace FireflyIII\Import\Converter;
-use FireflyIII\Exceptions\FireflyException;
use Log;
/**
@@ -34,11 +33,13 @@ class INGDebetCredit extends BasicConverter implements ConverterInterface
if ($value === 'Af') {
Log::debug('Return -1');
$this->setCertainty(100);
+
return -1;
}
$this->setCertainty(100);
Log::debug('Return 1');
+
return 1;
}
diff --git a/app/Import/Converter/OpposingAccountIban.php b/app/Import/Converter/OpposingAccountIban.php
index 123dc0a9b3..a0ccc57038 100644
--- a/app/Import/Converter/OpposingAccountIban.php
+++ b/app/Import/Converter/OpposingAccountIban.php
@@ -35,6 +35,7 @@ class OpposingAccountIban extends BasicConverter implements ConverterInterface
if (strlen($value) === 0) {
$this->setCertainty(0);
+
return new Account;
}
@@ -48,6 +49,7 @@ class OpposingAccountIban extends BasicConverter implements ConverterInterface
if (!is_null($account->id)) {
Log::debug('Found account by ID', ['id' => $account->id]);
$this->setCertainty(100);
+
return $account;
}
}
diff --git a/app/Import/Converter/OpposingAccountName.php b/app/Import/Converter/OpposingAccountName.php
index d5fe3fb7d6..e035de8ad0 100644
--- a/app/Import/Converter/OpposingAccountName.php
+++ b/app/Import/Converter/OpposingAccountName.php
@@ -35,6 +35,7 @@ class OpposingAccountName extends BasicConverter implements ConverterInterface
if (strlen($value) === 0) {
$this->setCertainty(0);
+
return new Account;
}
diff --git a/app/Import/Converter/OpposingAccountNumber.php b/app/Import/Converter/OpposingAccountNumber.php
index ede513646a..d8fbc02e62 100644
--- a/app/Import/Converter/OpposingAccountNumber.php
+++ b/app/Import/Converter/OpposingAccountNumber.php
@@ -12,7 +12,6 @@ declare(strict_types = 1);
namespace FireflyIII\Import\Converter;
use FireflyIII\Crud\Account\AccountCrudInterface;
-use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Models\Account;
use FireflyIII\Models\AccountType;
use Log;
@@ -37,6 +36,7 @@ class OpposingAccountNumber extends BasicConverter implements ConverterInterface
if (strlen($value) === 0) {
$this->setCertainty(0);
+
return new Account;
}
@@ -50,6 +50,7 @@ class OpposingAccountNumber extends BasicConverter implements ConverterInterface
if (!is_null($account->id)) {
Log::debug('Found account by ID', ['id' => $account->id]);
$this->setCertainty(100);
+
return $account;
}
}
@@ -59,6 +60,7 @@ class OpposingAccountNumber extends BasicConverter implements ConverterInterface
if (!is_null($account->id)) {
Log::debug('Found account by number', ['id' => $account->id]);
$this->setCertainty(50);
+
return $account;
}
@@ -79,6 +81,7 @@ class OpposingAccountNumber extends BasicConverter implements ConverterInterface
'virtualBalance' => 0, 'accountNumber' => $value, 'active' => true]
);
$this->setCertainty(100);
+
return $account;
}
diff --git a/app/Import/ImportProcedure.php b/app/Import/ImportProcedure.php
index 414424fcc7..9b26b1dff5 100644
--- a/app/Import/ImportProcedure.php
+++ b/app/Import/ImportProcedure.php
@@ -77,4 +77,4 @@ class ImportProcedure
return $result;
}
-}
\ No newline at end of file
+}
diff --git a/app/Import/ImportStorage.php b/app/Import/ImportStorage.php
index ba0f23f91d..340d8a630f 100644
--- a/app/Import/ImportStorage.php
+++ b/app/Import/ImportStorage.php
@@ -330,8 +330,8 @@ class ImportStorage
{
if ($entry->valid === false) {
Log::warning(sprintf('Cannot import row %d, because the entry is not valid.', $index));
- $errors = join(', ', $entry->errors->all());
- $errorText = sprintf('Row #%d: ' . $errors, $index);
+ $errors = join(', ', $entry->errors->all());
+ $errorText = sprintf('Row #%d: ' . $errors, $index);
$extendedStatus = $this->job->extended_status;
$extendedStatus['errors'][] = $errorText;
$this->job->extended_status = $extendedStatus;
@@ -342,7 +342,7 @@ class ImportStorage
$alreadyImported = $this->alreadyImported($entry->hash);
if (!is_null($alreadyImported->id)) {
Log::warning(sprintf('Cannot import row %d, because it has already been imported (journal #%d).', $index, $alreadyImported->id));
- $errorText = trans(
+ $errorText = trans(
'firefly.import_double',
['row' => $index, 'link' => route('transactions.show', [$alreadyImported->id]), 'description' => $alreadyImported->description]
);
diff --git a/app/Import/ImportValidator.php b/app/Import/ImportValidator.php
index e22c2418cb..672d5b99a2 100644
--- a/app/Import/ImportValidator.php
+++ b/app/Import/ImportValidator.php
@@ -29,6 +29,8 @@ use Log;
*/
class ImportValidator
{
+ /** @var ImportJob */
+ public $job;
/** @var Account */
protected $defaultImportAccount;
/** @var Collection */
@@ -36,19 +38,6 @@ class ImportValidator
/** @var User */
protected $user;
- /** @var ImportJob */
- public $job;
-
- /**
- * @param ImportJob $job
- */
- public function setJob(ImportJob $job)
- {
- $this->job = $job;
- }
-
-
-
/**
* ImportValidator constructor.
*
@@ -100,6 +89,14 @@ class ImportValidator
$this->defaultImportAccount = $defaultImportAccount;
}
+ /**
+ * @param ImportJob $job
+ */
+ public function setJob(ImportJob $job)
+ {
+ $this->job = $job;
+ }
+
/**
* @param User $user
*/
diff --git a/app/Import/Importer/ImporterInterface.php b/app/Import/Importer/ImporterInterface.php
index 91dcbd3a7d..2ebd905f09 100644
--- a/app/Import/Importer/ImporterInterface.php
+++ b/app/Import/Importer/ImporterInterface.php
@@ -10,6 +10,7 @@
declare(strict_types = 1);
namespace FireflyIII\Import\Importer;
+
use FireflyIII\Models\ImportJob;
use Illuminate\Support\Collection;
diff --git a/app/Import/Mapper/OpposingAccountIbans.php b/app/Import/Mapper/OpposingAccountIbans.php
index 2e1b7c8511..8ab544e8df 100644
--- a/app/Import/Mapper/OpposingAccountIbans.php
+++ b/app/Import/Mapper/OpposingAccountIbans.php
@@ -29,13 +29,14 @@ class OpposingAccountIbans implements MapperInterface
public function getMap(): array
{
/** @var AccountCrudInterface $crud */
- $crud = app(AccountCrudInterface::class);
- $set = $crud->getAccountsByType(
+ $crud = app(AccountCrudInterface::class);
+ $set = $crud->getAccountsByType(
[
AccountType::DEFAULT, AccountType::ASSET,
AccountType::EXPENSE, AccountType::BENEFICIARY,
- AccountType::REVENUE
- ]);
+ AccountType::REVENUE,
+ ]
+ );
$topList = [];
$list = [];
diff --git a/app/Import/Mapper/OpposingAccounts.php b/app/Import/Mapper/OpposingAccounts.php
index 37f67dccae..13392a8f66 100644
--- a/app/Import/Mapper/OpposingAccounts.php
+++ b/app/Import/Mapper/OpposingAccounts.php
@@ -34,8 +34,9 @@ class OpposingAccounts implements MapperInterface
[
AccountType::DEFAULT, AccountType::ASSET,
AccountType::EXPENSE, AccountType::BENEFICIARY,
- AccountType::REVENUE
- ]);
+ AccountType::REVENUE,
+ ]
+ );
$list = [];
/** @var Account $account */
diff --git a/app/Import/Setup/SetupInterface.php b/app/Import/Setup/SetupInterface.php
index b45c4337c0..23d80cc14d 100644
--- a/app/Import/Setup/SetupInterface.php
+++ b/app/Import/Setup/SetupInterface.php
@@ -11,7 +11,6 @@ declare(strict_types = 1);
namespace FireflyIII\Import\Setup;
-use FireflyIII\Import\Role\Map;
use FireflyIII\Models\ImportJob;
use Illuminate\Http\Request;
use Symfony\Component\HttpFoundation\FileBag;
@@ -46,14 +45,6 @@ interface SetupInterface
*/
public function getDataForSettings(): array;
- /**
- * Store the settings filled in by the user, if applicable.
- *
- * @param Request $request
- *
- */
- public function storeSettings(Request $request);
-
/**
* This method returns the name of the view that will be shown to the user to further configure
* the import job.
@@ -82,4 +73,12 @@ interface SetupInterface
*
*/
public function setJob(ImportJob $job);
+
+ /**
+ * Store the settings filled in by the user, if applicable.
+ *
+ * @param Request $request
+ *
+ */
+ public function storeSettings(Request $request);
}
diff --git a/app/Import/Specifics/AbnAmroDescription.php b/app/Import/Specifics/AbnAmroDescription.php
index a98d36f728..054973c292 100644
--- a/app/Import/Specifics/AbnAmroDescription.php
+++ b/app/Import/Specifics/AbnAmroDescription.php
@@ -133,7 +133,7 @@ class AbnAmroDescription implements SpecificInterface
break;
case 'NAAM':
$this->row[8] = $value;
- $name = $value;
+ $name = $value;
break;
case 'KENMERK':
$reference = $value;
diff --git a/app/Import/Specifics/SpecificInterface.php b/app/Import/Specifics/SpecificInterface.php
index b3e0b7d7df..c1536110e4 100644
--- a/app/Import/Specifics/SpecificInterface.php
+++ b/app/Import/Specifics/SpecificInterface.php
@@ -21,12 +21,12 @@ interface SpecificInterface
/**
* @return string
*/
- public static function getName(): string;
+ public static function getDescription(): string;
/**
* @return string
*/
- public static function getDescription(): string;
+ public static function getName(): string;
/**
* @param array $row
diff --git a/app/Models/TransactionJournalMeta.php b/app/Models/TransactionJournalMeta.php
index a3da2f15c1..c868d2ad0d 100644
--- a/app/Models/TransactionJournalMeta.php
+++ b/app/Models/TransactionJournalMeta.php
@@ -34,6 +34,7 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
* @mixin \Eloquent
* @property string $hash
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionJournalMeta whereHash($value)
+ * @property-read \FireflyIII\Models\TransactionJournal $transactionJournal
*/
class TransactionJournalMeta extends Model
{
diff --git a/app/Providers/CrudServiceProvider.php b/app/Providers/CrudServiceProvider.php
index 1eeacfa735..7deb62bab1 100644
--- a/app/Providers/CrudServiceProvider.php
+++ b/app/Providers/CrudServiceProvider.php
@@ -12,10 +12,8 @@ declare(strict_types = 1);
namespace FireflyIII\Providers;
use FireflyIII\Exceptions\FireflyException;
-use Illuminate\Auth\AuthManager;
use Illuminate\Foundation\Application;
use Illuminate\Support\ServiceProvider;
-use Log;
/**
* Class CrudServiceProvider
@@ -58,6 +56,7 @@ class CrudServiceProvider extends ServiceProvider
if (!isset($arguments[0]) && !$app->auth->check()) {
throw new FireflyException('There is no user present.');
}
+
return app('FireflyIII\Crud\Account\AccountCrud', $arguments);
}
);
diff --git a/app/Repositories/Account/AccountRepository.php b/app/Repositories/Account/AccountRepository.php
index 048f55280b..eda705f8b2 100644
--- a/app/Repositories/Account/AccountRepository.php
+++ b/app/Repositories/Account/AccountRepository.php
@@ -144,7 +144,6 @@ class AccountRepository implements AccountRepositoryInterface
$ids = $query->get(['transaction_journals.id'])->pluck('id')->toArray();
-
// that should do it:
$sum = $this->user->transactions()
->whereIn('transaction_journal_id', $ids)
diff --git a/app/Repositories/Tag/TagRepositoryInterface.php b/app/Repositories/Tag/TagRepositoryInterface.php
index fad9b301c8..ca6e33fa1e 100644
--- a/app/Repositories/Tag/TagRepositoryInterface.php
+++ b/app/Repositories/Tag/TagRepositoryInterface.php
@@ -43,18 +43,18 @@ interface TagRepositoryInterface
public function destroy(Tag $tag): bool;
/**
- * @param string $tag
+ * @param int $tagId
*
* @return Tag
*/
- public function findByTag(string $tag) : Tag;
+ public function find(int $tagId) : Tag;
/**
- * @param int $tagId
+ * @param string $tag
*
* @return Tag
*/
- public function find(int $tagId) : Tag;
+ public function findByTag(string $tag) : Tag;
/**
* This method returns all the user's tags.
diff --git a/app/Rules/Actions/AddTag.php b/app/Rules/Actions/AddTag.php
index ef61c7dd77..fb5fe7c766 100644
--- a/app/Rules/Actions/AddTag.php
+++ b/app/Rules/Actions/AddTag.php
@@ -12,7 +12,6 @@ declare(strict_types = 1);
namespace FireflyIII\Rules\Actions;
-use Auth;
use FireflyIII\Models\RuleAction;
use FireflyIII\Models\Tag;
use FireflyIII\Models\TransactionJournal;
diff --git a/app/Rules/Actions/RemoveTag.php b/app/Rules/Actions/RemoveTag.php
index d3ebaf93bd..85da146b24 100644
--- a/app/Rules/Actions/RemoveTag.php
+++ b/app/Rules/Actions/RemoveTag.php
@@ -12,7 +12,6 @@ declare(strict_types = 1);
namespace FireflyIII\Rules\Actions;
-use Auth;
use FireflyIII\Models\RuleAction;
use FireflyIII\Models\Tag;
use FireflyIII\Models\TransactionJournal;
diff --git a/app/Rules/Actions/SetCategory.php b/app/Rules/Actions/SetCategory.php
index ef833e6278..7a298a85f9 100644
--- a/app/Rules/Actions/SetCategory.php
+++ b/app/Rules/Actions/SetCategory.php
@@ -12,7 +12,6 @@ declare(strict_types = 1);
namespace FireflyIII\Rules\Actions;
-use Auth;
use FireflyIII\Models\Category;
use FireflyIII\Models\RuleAction;
use FireflyIII\Models\TransactionJournal;
diff --git a/app/Support/Twig/Rule.php b/app/Support/Twig/Rule.php
index e5453688bc..36806aa0c9 100644
--- a/app/Support/Twig/Rule.php
+++ b/app/Support/Twig/Rule.php
@@ -23,6 +23,26 @@ use Twig_SimpleFunction;
class Rule extends Twig_Extension
{
+ /**
+ * @return Twig_SimpleFunction
+ */
+ public function allActionTriggers(): Twig_SimpleFunction
+ {
+ return new Twig_SimpleFunction(
+ 'allRuleActions', function () {
+ // array of valid values for actions
+ $ruleActions = array_keys(Config::get('firefly.rule-actions'));
+ $possibleActions = [];
+ foreach ($ruleActions as $key) {
+ $possibleActions[$key] = trans('firefly.rule_action_' . $key . '_choice');
+ }
+ unset($key, $ruleActions);
+
+ return $possibleActions;
+ }
+ );
+ }
+
/**
* @return Twig_SimpleFunction
*/
@@ -61,26 +81,6 @@ class Rule extends Twig_Extension
}
- /**
- * @return Twig_SimpleFunction
- */
- public function allActionTriggers(): Twig_SimpleFunction
- {
- return new Twig_SimpleFunction(
- 'allRuleActions', function () {
- // array of valid values for actions
- $ruleActions = array_keys(Config::get('firefly.rule-actions'));
- $possibleActions = [];
- foreach ($ruleActions as $key) {
- $possibleActions[$key] = trans('firefly.rule_action_' . $key . '_choice');
- }
- unset($key, $ruleActions);
-
- return $possibleActions;
- }
- );
- }
-
/**
* @return array
*/
diff --git a/app/User.php b/app/User.php
index 0c51395c41..b200536c65 100644
--- a/app/User.php
+++ b/app/User.php
@@ -54,9 +54,9 @@ use Illuminate\Foundation\Auth\User as Authenticatable;
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\User whereBlocked($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\User whereBlockedCode($value)
* @mixin \Eloquent
- * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\ImportJob[] $importjobs
- * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\PiggyBank[] $piggyBanks
- * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Transaction[] $transactions
+ * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\ImportJob[] $importjobs
+ * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\PiggyBank[] $piggyBanks
+ * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Transaction[] $transactions
*/
class User extends Authenticatable
{
@@ -148,14 +148,6 @@ class User extends Authenticatable
return $this->hasMany('FireflyIII\Models\ExportJob');
}
- /**
- * @return HasMany
- */
- public function importjobs(): HasMany
- {
- return $this->hasMany('FireflyIII\Models\ImportJob');
- }
-
/**
* Checks if the user has a role by its name.
*
@@ -177,6 +169,14 @@ class User extends Authenticatable
return false;
}
+ /**
+ * @return HasMany
+ */
+ public function importjobs(): HasMany
+ {
+ return $this->hasMany('FireflyIII\Models\ImportJob');
+ }
+
/**
* @return HasManyThrough
*/
diff --git a/config/auth.php b/config/auth.php
index 7d48693a30..33365af51c 100644
--- a/config/auth.php
+++ b/config/auth.php
@@ -2,7 +2,6 @@
declare(strict_types = 1);
-
return [
'allow_register' => true,
diff --git a/config/broadcasting.php b/config/broadcasting.php
index 25ace51efa..96c0006476 100644
--- a/config/broadcasting.php
+++ b/config/broadcasting.php
@@ -2,7 +2,6 @@
declare(strict_types = 1);
-
return [
/*
@@ -32,17 +31,17 @@ return [
'connections' => [
'pusher' => [
- 'driver' => 'pusher',
- 'key' => env('PUSHER_KEY'),
- 'secret' => env('PUSHER_SECRET'),
- 'app_id' => env('PUSHER_APP_ID'),
+ 'driver' => 'pusher',
+ 'key' => env('PUSHER_KEY'),
+ 'secret' => env('PUSHER_SECRET'),
+ 'app_id' => env('PUSHER_APP_ID'),
'options' => [
//
],
],
'redis' => [
- 'driver' => 'redis',
+ 'driver' => 'redis',
'connection' => 'default',
],
diff --git a/config/cache.php b/config/cache.php
index f45c4fb25c..23dc94d57a 100644
--- a/config/cache.php
+++ b/config/cache.php
@@ -2,7 +2,6 @@
declare(strict_types = 1);
-
return [
/*
@@ -40,8 +39,8 @@ return [
],
'database' => [
- 'driver' => 'database',
- 'table' => 'cache',
+ 'driver' => 'database',
+ 'table' => 'cache',
'connection' => null,
],
@@ -60,7 +59,7 @@ return [
],
'redis' => [
- 'driver' => 'redis',
+ 'driver' => 'redis',
'connection' => 'default',
],
diff --git a/config/database.php b/config/database.php
index 40a8db36e2..65bbf28c04 100644
--- a/config/database.php
+++ b/config/database.php
@@ -2,7 +2,6 @@
declare(strict_types = 1);
-
return [
/*
diff --git a/config/entrust.php b/config/entrust.php
index 629fc169ff..08e31ddedd 100644
--- a/config/entrust.php
+++ b/config/entrust.php
@@ -2,7 +2,6 @@
declare(strict_types = 1);
-
/**
* This file is part of Entrust,
* a role & permission management solution for Laravel.
diff --git a/config/filesystems.php b/config/filesystems.php
index 94ec2811e5..9c547da6bf 100644
--- a/config/filesystems.php
+++ b/config/filesystems.php
@@ -2,7 +2,6 @@
declare(strict_types = 1);
-
return [
/*
diff --git a/config/mail.php b/config/mail.php
index 1027fe9952..b4aa57e8e1 100644
--- a/config/mail.php
+++ b/config/mail.php
@@ -2,7 +2,6 @@
declare(strict_types = 1);
-
return [
/*
diff --git a/config/session.php b/config/session.php
index cbe38ed46d..b0ad3c1522 100644
--- a/config/session.php
+++ b/config/session.php
@@ -2,7 +2,6 @@
declare(strict_types = 1);
-
return [
/*
diff --git a/config/twigbridge.php b/config/twigbridge.php
index 586f7f047e..fc1773d542 100644
--- a/config/twigbridge.php
+++ b/config/twigbridge.php
@@ -2,9 +2,8 @@
declare(strict_types = 1);
-
return [
- 'twig' => [
+ 'twig' => [
/*
|--------------------------------------------------------------------------
| Extension
@@ -135,8 +134,8 @@ return [
'facades' => [
'Breadcrumbs' => [
'is_safe' => [
- 'renderIfExists'
- ]
+ 'renderIfExists',
+ ],
],
'Session',
'Route',
@@ -148,13 +147,13 @@ return [
'ExpandedForm' => [
'is_safe' => [
'date', 'text', 'select', 'balance', 'optionsList', 'checkbox', 'amount', 'tags', 'integer', 'textarea', 'location',
- 'multiRadio', 'file', 'multiCheckbox', 'staticText', 'amountSmall',
- ]
+ 'multiRadio', 'file', 'multiCheckbox', 'staticText', 'amountSmall',
+ ],
],
'Form' => [
'is_safe' => [
- 'input', 'select', 'checkbox', 'model', 'open', 'radio', 'textarea', 'file'
- ]
+ 'input', 'select', 'checkbox', 'model', 'open', 'radio', 'textarea', 'file',
+ ],
],
],
@@ -190,7 +189,7 @@ return [
'elixir',
'head',
'last',
- 'old'
+ 'old',
],
/*
@@ -222,5 +221,5 @@ return [
|
*/
'filters' => [],
- ]
+ ],
];
diff --git a/config/upgrade.php b/config/upgrade.php
index d12d96b1c3..1058d2e18b 100644
--- a/config/upgrade.php
+++ b/config/upgrade.php
@@ -27,6 +27,6 @@ return [
'Please follow the instructions on the following page: https://github.com/JC5/firefly-iii/wiki/Upgrade-to-3.7.0',
'3.8.0' => 'This version of Firefly III requires PHP 7.0.',
'3.8.1' => 'This version of Firefly III requires PHP 7.0.',
- '3.10' => 'Please find the full upgrade instructions here: https://github.com/JC5/firefly-iii/wiki/Upgrade-to-3.10'
+ '3.10' => 'Please find the full upgrade instructions here: https://github.com/JC5/firefly-iii/wiki/Upgrade-to-3.10',
],
];
diff --git a/config/view.php b/config/view.php
index 5956e661ef..46edee6b34 100644
--- a/config/view.php
+++ b/config/view.php
@@ -2,7 +2,6 @@
declare(strict_types = 1);
-
return [
/*