Code cleanup.

This commit is contained in:
James Cole
2023-12-20 19:35:52 +01:00
parent c4f6366642
commit 64ec0cf62e
997 changed files with 12908 additions and 28136 deletions

View File

@@ -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)