mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-15 08:35:00 +00:00
Code cleanup.
This commit is contained in:
@@ -47,7 +47,6 @@ class ApplyRules extends Command
|
||||
use ShowsFriendlyMessages;
|
||||
use VerifiesAccessToken;
|
||||
|
||||
|
||||
protected $description = 'This command will apply your rules and rule groups on a selection of your transactions.';
|
||||
|
||||
protected $signature
|
||||
@@ -74,7 +73,6 @@ class ApplyRules extends Command
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return int
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function handle(): int
|
||||
@@ -149,8 +147,6 @@ class ApplyRules extends Command
|
||||
* Laravel will execute ALL __construct() methods for ALL commands whenever a SINGLE command is
|
||||
* executed. This leads to noticeable slow-downs and class calls. To prevent this, this method should
|
||||
* be called from the handle method instead of using the constructor to initialize the command.
|
||||
*
|
||||
|
||||
*/
|
||||
private function stupidLaravel(): void
|
||||
{
|
||||
@@ -165,7 +161,6 @@ class ApplyRules extends Command
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
* @throws FireflyException
|
||||
*/
|
||||
private function verifyInput(): bool
|
||||
@@ -188,7 +183,6 @@ class ApplyRules extends Command
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
* @throws FireflyException
|
||||
*/
|
||||
private function verifyInputAccounts(): bool
|
||||
@@ -223,9 +217,6 @@ class ApplyRules extends Command
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
private function verifyInputRuleGroups(): bool
|
||||
{
|
||||
$ruleGroupString = $this->option('rule_groups');
|
||||
@@ -248,9 +239,6 @@ class ApplyRules extends Command
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
private function verifyInputRules(): bool
|
||||
{
|
||||
$ruleString = $this->option('rules');
|
||||
@@ -299,6 +287,7 @@ class ApplyRules extends Command
|
||||
}
|
||||
if (false === $inputEnd || false === $inputStart) {
|
||||
Log::error('Could not parse start or end date in verifyInputDate().');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -310,22 +299,19 @@ class ApplyRules extends Command
|
||||
$this->endDate = $inputEnd;
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
private function grabAllRules(): void
|
||||
{
|
||||
$this->groups = $this->ruleGroupRepository->getActiveGroups();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection
|
||||
*/
|
||||
private function getRulesToApply(): Collection
|
||||
{
|
||||
$rulesToApply = new Collection();
|
||||
|
||||
/** @var RuleGroup $group */
|
||||
foreach ($this->groups as $group) {
|
||||
$rules = $this->ruleGroupRepository->getActiveStoreRules($group);
|
||||
|
||||
/** @var Rule $rule */
|
||||
foreach ($rules as $rule) {
|
||||
// if in rule selection, or group in selection or all rules, it's included.
|
||||
@@ -340,12 +326,6 @@ class ApplyRules extends Command
|
||||
return $rulesToApply;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Rule $rule
|
||||
* @param RuleGroup $group
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
private function includeRule(Rule $rule, RuleGroup $group): bool
|
||||
{
|
||||
return in_array($group->id, $this->ruleGroupSelection, true)
|
||||
|
Reference in New Issue
Block a user