Skip to content

Firefly III: a personal finances manager

Some code cleanup

James Coleababdacf891f
diff --git a/app/Export/Collector/BasicCollector.php b/app/Export/Collector/BasicCollector.php
index 03bf62ac3d..c779a1fa02 100644
--- a/app/Export/Collector/BasicCollector.php
+++ b/app/Export/Collector/BasicCollector.php
@@ -21,11 +21,10 @@ use Illuminate\Support\Collection;
*/
class BasicCollector
{
- /** @var Collection */
- private $files;
-
/** @var ExportJob */
protected $job;
+ /** @var Collection */
+ private $files;
/**
* BasicCollector constructor.
diff --git a/app/Export/Collector/CollectorInterface.php b/app/Export/Collector/CollectorInterface.php
index 349fee971d..f220c479ec 100644
--- a/app/Export/Collector/CollectorInterface.php
+++ b/app/Export/Collector/CollectorInterface.php
@@ -9,6 +9,7 @@ declare(strict_types = 1);
*/
namespace FireflyIII\Export\Collector;
+
use Illuminate\Support\Collection;
/**
@@ -19,14 +20,14 @@ use Illuminate\Support\Collection;
interface CollectorInterface
{
/**
- * @return bool
+ * @return Collection
*/
- public function run();
+ public function getFiles();
/**
- * @return Collection
+ * @return bool
*/
- public function getFiles();
+ public function run();
/**
* @param Collection $files
diff --git a/app/Export/Exporter/BasicExporter.php b/app/Export/Exporter/BasicExporter.php
index 627dbabbe9..4366415d81 100644
--- a/app/Export/Exporter/BasicExporter.php
+++ b/app/Export/Exporter/BasicExporter.php
@@ -21,10 +21,9 @@ use Illuminate\Support\Collection;
*/
class BasicExporter
{
- private $entries;
-
/** @var ExportJob */
protected $job;
+ private $entries;
/**
* BasicExporter constructor.
@@ -34,7 +33,7 @@ class BasicExporter
public function __construct(ExportJob $job)
{
$this->entries = new Collection;
- $this->job = $job;
+ $this->job = $job;
}
/**
@@ -54,5 +53,4 @@ class BasicExporter
}
-
}
diff --git a/app/Export/Exporter/ExporterInterface.php b/app/Export/Exporter/ExporterInterface.php
index 165f529823..aed29b2daa 100644
--- a/app/Export/Exporter/ExporterInterface.php
+++ b/app/Export/Exporter/ExporterInterface.php
@@ -9,6 +9,7 @@ declare(strict_types = 1);
*/
namespace FireflyIII\Export\Exporter;
+
use Illuminate\Support\Collection;
/**
@@ -23,6 +24,11 @@ interface ExporterInterface
*/
public function getEntries();
+ /**
+ * @return string
+ */
+ public function getFileName();
+
/**
*
*/
@@ -34,9 +40,4 @@ interface ExporterInterface
*/
public function setEntries(Collection $entries);
- /**
- * @return string
- */
- public function getFileName();
-
}
diff --git a/app/Generator/Chart/Report/ChartJsReportChartGenerator.php b/app/Generator/Chart/Report/ChartJsReportChartGenerator.php
index 334621abca..2854740f00 100644
--- a/app/Generator/Chart/Report/ChartJsReportChartGenerator.php
+++ b/app/Generator/Chart/Report/ChartJsReportChartGenerator.php
@@ -95,7 +95,7 @@ class ChartJsReportChartGenerator implements ReportChartGeneratorInterface
],
];
foreach ($entries as $entry) {
- $data['labels'][] = trim($entry['date']->formatLocalized($format));
+ $data['labels'][] = trim($entry['date']->formatLocalized($format));
$data['datasets'][0]['data'][] = floatval($entry['net-worth']);
}
diff --git a/app/Handlers/Events/FireRulesForStore.php b/app/Handlers/Events/FireRulesForStore.php
index 754e112013..38e37bc64a 100644
--- a/app/Handlers/Events/FireRulesForStore.php
+++ b/app/Handlers/Events/FireRulesForStore.php
@@ -63,6 +63,7 @@ class FireRulesForStore
}
}
+
return true;
}
}
diff --git a/app/Handlers/Events/FireRulesForUpdate.php b/app/Handlers/Events/FireRulesForUpdate.php
index fce152f3b9..a645f151ff 100644
--- a/app/Handlers/Events/FireRulesForUpdate.php
+++ b/app/Handlers/Events/FireRulesForUpdate.php
@@ -62,6 +62,7 @@ class FireRulesForUpdate
}
}
+
return true;
}
}
diff --git a/app/Handlers/Events/ScanForBillsAfterStore.php b/app/Handlers/Events/ScanForBillsAfterStore.php
index 3106634487..ffcb3f26ac 100644
--- a/app/Handlers/Events/ScanForBillsAfterStore.php
+++ b/app/Handlers/Events/ScanForBillsAfterStore.php
@@ -33,6 +33,7 @@ class ScanForBillsAfterStore
{
$journal = $event->journal;
BillScanner::scan($journal);
+
return true;
}
diff --git a/app/Handlers/Events/ScanForBillsAfterUpdate.php b/app/Handlers/Events/ScanForBillsAfterUpdate.php
index c2dee9ea12..5061b9e315 100644
--- a/app/Handlers/Events/ScanForBillsAfterUpdate.php
+++ b/app/Handlers/Events/ScanForBillsAfterUpdate.php
@@ -32,6 +32,7 @@ class ScanForBillsAfterUpdate
{
$journal = $event->journal;
BillScanner::scan($journal);
+
return true;
}
diff --git a/app/Helpers/Csv/PostProcessing/AssetAccount.php b/app/Helpers/Csv/PostProcessing/AssetAccount.php
index e7439bfb7a..7ee7986b76 100644
--- a/app/Helpers/Csv/PostProcessing/AssetAccount.php
+++ b/app/Helpers/Csv/PostProcessing/AssetAccount.php
@@ -245,7 +245,7 @@ class AssetAccount implements PostProcessorInterface
}
// create new if not exists and return that one:
/** @var \FireflyIII\Repositories\Account\AccountRepositoryInterface $repository */
- $repository = app('FireflyIII\Repositories\Account\AccountRepositoryInterface');
+ $repository = app('FireflyIII\Repositories\Account\AccountRepositoryInterface');
$accountData = [
'name' => $accountNumber,
'accountType' => 'asset',
@@ -260,7 +260,7 @@ class AssetAccount implements PostProcessorInterface
'openingBalanceDate' => new Carbon,
'openingBalanceCurrency' => 1, // hard coded.
];
- $account = $repository->store($accountData);
+ $account = $repository->store($accountData);
return $account;
}
diff --git a/app/Helpers/Report/BalanceReportHelper.php b/app/Helpers/Report/BalanceReportHelper.php
index bf3f961df6..a33163df3f 100644
--- a/app/Helpers/Report/BalanceReportHelper.php
+++ b/app/Helpers/Report/BalanceReportHelper.php
@@ -15,8 +15,8 @@ use FireflyIII\Helpers\Collection\Balance;
use FireflyIII\Helpers\Collection\BalanceEntry;
use FireflyIII\Helpers\Collection\BalanceHeader;
use FireflyIII\Helpers\Collection\BalanceLine;
-use FireflyIII\Models\Budget as BudgetModel;
use FireflyIII\Models\Budget;
+use FireflyIII\Models\Budget as BudgetModel;
use FireflyIII\Models\Tag;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
diff --git a/app/Http/Controllers/NewUserController.php b/app/Http/Controllers/NewUserController.php
index 791d0cbfeb..5560401813 100644
--- a/app/Http/Controllers/NewUserController.php
+++ b/app/Http/Controllers/NewUserController.php
@@ -4,7 +4,6 @@ use Auth;
use Carbon\Carbon;
use Config;
use FireflyIII\Http\Requests\NewUserFormRequest;
-use FireflyIII\Models\AccountMeta;
use FireflyIII\Repositories\Account\AccountRepositoryInterface as ARI;
use Preferences;
use Session;
diff --git a/app/Http/Controllers/TransactionController.php b/app/Http/Controllers/TransactionController.php
index e137f6bf77..64db219d7f 100644
--- a/app/Http/Controllers/TransactionController.php
+++ b/app/Http/Controllers/TransactionController.php
@@ -161,7 +161,7 @@ class TransactionController extends Controller
'tags' => join(',', $journal->tags->pluck('tag')->toArray()),
];
- $category = $journal->categories()->first();
+ $category = $journal->categories()->first();
if (!is_null($category)) {
$preFilled['category'] = $category->name;
}
diff --git a/app/Http/Middleware/Authenticate.php b/app/Http/Middleware/Authenticate.php
index b0a1f9af9a..483cacaae4 100644
--- a/app/Http/Middleware/Authenticate.php
+++ b/app/Http/Middleware/Authenticate.php
@@ -7,6 +7,7 @@ use Closure;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Session;
+
/**
* Class Authenticate
*
diff --git a/app/Http/Requests/TokenFormRequest.php b/app/Http/Requests/TokenFormRequest.php
index 19456f635b..c4badfd780 100644
--- a/app/Http/Requests/TokenFormRequest.php
+++ b/app/Http/Requests/TokenFormRequest.php
@@ -4,7 +4,6 @@ declare(strict_types = 1);
namespace FireflyIII\Http\Requests;
use Auth;
-use Input;
/**
* Class TokenFormRequest
@@ -30,8 +29,8 @@ class TokenFormRequest extends Request
{
$rules = [
- 'secret' => 'required',
- 'code' => 'required|2faCode:secret',
+ 'secret' => 'required',
+ 'code' => 'required|2faCode:secret',
];
return $rules;
diff --git a/app/Models/Role.php b/app/Models/Role.php
index 9052cc2d96..7cd850d640 100644
--- a/app/Models/Role.php
+++ b/app/Models/Role.php
@@ -11,12 +11,12 @@ use Illuminate\Database\Eloquent\Relations\BelongsToMany;
* Class Role
*
* @package FireflyIII\Models
- * @property integer $id
- * @property string $name
- * @property string $display_name
- * @property string $description
- * @property \Carbon\Carbon $created_at
- * @property \Carbon\Carbon $updated_at
+ * @property integer $id
+ * @property string $name
+ * @property string $display_name
+ * @property string $description
+ * @property \Carbon\Carbon $created_at
+ * @property \Carbon\Carbon $updated_at
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\User[] $users
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Role whereId($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Role whereName($value)
diff --git a/app/Models/TransactionJournalMeta.php b/app/Models/TransactionJournalMeta.php
index 2f29a41785..37bff90fae 100644
--- a/app/Models/TransactionJournalMeta.php
+++ b/app/Models/TransactionJournalMeta.php
@@ -17,12 +17,12 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
*
* @package FireflyIII\Models
* @property-read \FireflyIII\Models\TransactionJournal $transactionjournal
- * @property integer $id
- * @property \Carbon\Carbon $created_at
- * @property \Carbon\Carbon $updated_at
- * @property integer $transaction_journal_id
- * @property string $name
- * @property string $data
+ * @property integer $id
+ * @property \Carbon\Carbon $created_at
+ * @property \Carbon\Carbon $updated_at
+ * @property integer $transaction_journal_id
+ * @property string $name
+ * @property string $data
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionJournalMeta whereId($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionJournalMeta whereCreatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionJournalMeta whereUpdatedAt($value)
diff --git a/app/Providers/FireflyServiceProvider.php b/app/Providers/FireflyServiceProvider.php
index a2bd38a2e9..1318dafce1 100644
--- a/app/Providers/FireflyServiceProvider.php
+++ b/app/Providers/FireflyServiceProvider.php
@@ -19,7 +19,6 @@ use Illuminate\Support\ServiceProvider;
use Twig;
use TwigBridge\Extension\Loader\Functions;
use Validator;
-use Auth;
/**
* Class FireflyServiceProvider
diff --git a/app/Repositories/Budget/BudgetRepositoryInterface.php b/app/Repositories/Budget/BudgetRepositoryInterface.php
index 3765508d6f..f14526831d 100644
--- a/app/Repositories/Budget/BudgetRepositoryInterface.php
+++ b/app/Repositories/Budget/BudgetRepositoryInterface.php
@@ -169,8 +169,8 @@ interface BudgetRepositoryInterface
/**
* @param Collection $accounts
- * @param Carbon $start
- * @param Carbon $end
+ * @param Carbon $start
+ * @param Carbon $end
*
* @return string
*/
diff --git a/app/Rules/Actions/AddTag.php b/app/Rules/Actions/AddTag.php
index f1b4bd659f..39f936b3fd 100644
--- a/app/Rules/Actions/AddTag.php
+++ b/app/Rules/Actions/AddTag.php
@@ -24,17 +24,17 @@ use FireflyIII\Models\TransactionJournal;
class AddTag implements ActionInterface
{
- /** @var RuleAction */
+ /** @var RuleAction */
private $action;
/**
* TriggerInterface constructor.
*
- * @param RuleAction $action
+ * @param RuleAction $action
*/
public function __construct(RuleAction $action)
{
- $this->action = $action;
+ $this->action = $action;
}
/**
diff --git a/app/Rules/Actions/AppendDescription.php b/app/Rules/Actions/AppendDescription.php
index dac139aa47..21fb94de9e 100644
--- a/app/Rules/Actions/AppendDescription.php
+++ b/app/Rules/Actions/AppendDescription.php
@@ -27,11 +27,11 @@ class AppendDescription implements ActionInterface
/**
* TriggerInterface constructor.
*
- * @param RuleAction $action
+ * @param RuleAction $action
*/
public function __construct(RuleAction $action)
{
- $this->action = $action;
+ $this->action = $action;
}
/**
diff --git a/app/Rules/Actions/ClearBudget.php b/app/Rules/Actions/ClearBudget.php
index 0b54b01dee..503d3ca3be 100644
--- a/app/Rules/Actions/ClearBudget.php
+++ b/app/Rules/Actions/ClearBudget.php
@@ -28,11 +28,11 @@ class ClearBudget implements ActionInterface
/**
* TriggerInterface constructor.
*
- * @param RuleAction $action
+ * @param RuleAction $action
*/
public function __construct(RuleAction $action)
{
- $this->action = $action;
+ $this->action = $action;
}
/**
diff --git a/app/Rules/Actions/ClearCategory.php b/app/Rules/Actions/ClearCategory.php
index c21cca6bdc..98ba1c58a8 100644
--- a/app/Rules/Actions/ClearCategory.php
+++ b/app/Rules/Actions/ClearCategory.php
@@ -28,11 +28,11 @@ class ClearCategory implements ActionInterface
/**
* TriggerInterface constructor.
*
- * @param RuleAction $action
+ * @param RuleAction $action
*/
public function __construct(RuleAction $action)
{
- $this->action = $action;
+ $this->action = $action;
}
/**
diff --git a/app/Rules/Actions/PrependDescription.php b/app/Rules/Actions/PrependDescription.php
index 5d1dca8b24..3a692d8049 100644
--- a/app/Rules/Actions/PrependDescription.php
+++ b/app/Rules/Actions/PrependDescription.php
@@ -27,11 +27,11 @@ class PrependDescription implements ActionInterface
/**
* TriggerInterface constructor.
*
- * @param RuleAction $action
+ * @param RuleAction $action
*/
public function __construct(RuleAction $action)
{
- $this->action = $action;
+ $this->action = $action;
}
/**
diff --git a/app/Rules/Actions/RemoveAllTags.php b/app/Rules/Actions/RemoveAllTags.php
index dc8ff42b21..ebfbe2c49c 100644
--- a/app/Rules/Actions/RemoveAllTags.php
+++ b/app/Rules/Actions/RemoveAllTags.php
@@ -27,11 +27,11 @@ class RemoveAllTags implements ActionInterface
/**
* TriggerInterface constructor.
*
- * @param RuleAction $action
+ * @param RuleAction $action
*/
public function __construct(RuleAction $action)
{
- $this->action = $action;
+ $this->action = $action;
}
/**
diff --git a/app/Rules/Actions/RemoveTag.php b/app/Rules/Actions/RemoveTag.php
index 73e633b93f..b90b4eccb6 100644
--- a/app/Rules/Actions/RemoveTag.php
+++ b/app/Rules/Actions/RemoveTag.php
@@ -30,11 +30,11 @@ class RemoveTag implements ActionInterface
/**
* TriggerInterface constructor.
*
- * @param RuleAction $action
+ * @param RuleAction $action
*/
public function __construct(RuleAction $action)
{
- $this->action = $action;
+ $this->action = $action;
}
/**
diff --git a/app/Rules/Actions/SetBudget.php b/app/Rules/Actions/SetBudget.php
index b67fe36b90..7dca1968aa 100644
--- a/app/Rules/Actions/SetBudget.php
+++ b/app/Rules/Actions/SetBudget.php
@@ -31,11 +31,11 @@ class SetBudget implements ActionInterface
/**
* TriggerInterface constructor.
*
- * @param RuleAction $action
+ * @param RuleAction $action
*/
public function __construct(RuleAction $action)
{
- $this->action = $action;
+ $this->action = $action;
}
/**
diff --git a/app/Rules/Actions/SetCategory.php b/app/Rules/Actions/SetCategory.php
index 36f4bb506d..09e76a7461 100644
--- a/app/Rules/Actions/SetCategory.php
+++ b/app/Rules/Actions/SetCategory.php
@@ -31,11 +31,11 @@ class SetCategory implements ActionInterface
/**
* TriggerInterface constructor.
*
- * @param RuleAction $action
+ * @param RuleAction $action
*/
public function __construct(RuleAction $action)
{
- $this->action = $action;
+ $this->action = $action;
}
/**
diff --git a/app/Rules/Actions/SetDescription.php b/app/Rules/Actions/SetDescription.php
index 311052867a..98bb9c1284 100644
--- a/app/Rules/Actions/SetDescription.php
+++ b/app/Rules/Actions/SetDescription.php
@@ -27,11 +27,11 @@ class SetDescription implements ActionInterface
/**
* TriggerInterface constructor.
*
- * @param RuleAction $action
+ * @param RuleAction $action
*/
public function __construct(RuleAction $action)
{
- $this->action = $action;
+ $this->action = $action;
}
/**
diff --git a/app/Rules/Triggers/AbstractTrigger.php b/app/Rules/Triggers/AbstractTrigger.php
index 764184d56c..cd319afdf6 100644
--- a/app/Rules/Triggers/AbstractTrigger.php
+++ b/app/Rules/Triggers/AbstractTrigger.php
@@ -51,6 +51,7 @@ class AbstractTrigger
$self = new static;
$self->triggerValue = $triggerValue;
$self->stopProcessing = $stopProcessing;
+
return $self;
}
diff --git a/app/Rules/Triggers/FromAccountStarts.php b/app/Rules/Triggers/FromAccountStarts.php
index 886cca8949..88e7a7f791 100644
--- a/app/Rules/Triggers/FromAccountStarts.php
+++ b/app/Rules/Triggers/FromAccountStarts.php
@@ -54,7 +54,7 @@ final class FromAccountStarts extends AbstractTrigger implements TriggerInterfac
public function triggered(TransactionJournal $journal)
{
$name = $journal->source_account_name ?? strtolower(TransactionJournal::sourceAccount($journal)->name);
- $search = strtolower($this->triggerValue);
+ $search = strtolower($this->triggerValue);
$part = substr($name, 0, strlen($search));
diff --git a/app/Support/Steam.php b/app/Support/Steam.php
index 8debb4ac6b..34d22e7f70 100644
--- a/app/Support/Steam.php
+++ b/app/Support/Steam.php
@@ -40,9 +40,11 @@ class Steam
bcscale(2);
- $balance = strval($account->transactions()->leftJoin(
- 'transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id'
- )->where('transaction_journals.date', '<=', $date->format('Y-m-d'))->sum('transactions.amount'));
+ $balance = strval(
+ $account->transactions()->leftJoin(
+ 'transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id'
+ )->where('transaction_journals.date', '<=', $date->format('Y-m-d'))->sum('transactions.amount')
+ );
if (!$ignoreVirtualBalance) {
$balance = bcadd($balance, $account->virtual_balance);
diff --git a/app/Validation/FireflyValidator.php b/app/Validation/FireflyValidator.php
index 8535ed7fc4..d22271e8c3 100644
--- a/app/Validation/FireflyValidator.php
+++ b/app/Validation/FireflyValidator.php
@@ -16,13 +16,11 @@ use FireflyIII\Models\TransactionType;
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
use FireflyIII\Rules\Triggers\TriggerInterface;
use FireflyIII\User;
-use Input;
use Illuminate\Contracts\Encryption\DecryptException;
use Illuminate\Validation\Validator;
+use Input;
use Log;
-use PragmaRX\Google2FA\Contracts\Google2FA;
use Symfony\Component\Translation\TranslatorInterface;
-use Session;
/**
* Class FireflyValidator
@@ -59,13 +57,13 @@ class FireflyValidator extends Validator
{
if (!is_string($value) || is_null($value) || strlen($value) <> 6) {
return false;
- }
+ }
// Retrieve the secret from our hidden form field.
$secret = Input::get($parameters[0]);
$google2fa = app('PragmaRX\Google2FA\Google2FA');
-
+
return $google2fa->verifyKey($secret, $value);
}