Code clean up.

This commit is contained in:
James Cole
2016-02-17 18:23:20 +01:00
parent ddfbd69e8b
commit cd057045e6

View File

@@ -14,10 +14,10 @@ use FireflyIII\Models\Rule;
use FireflyIII\Models\RuleAction;
use FireflyIII\Models\RuleTrigger;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\Rules\Actions\ActionInterface;
use FireflyIII\Rules\Actions\ActionFactory;
use FireflyIII\Rules\Triggers\TriggerInterface;
use FireflyIII\Rules\Actions\ActionInterface;
use FireflyIII\Rules\Triggers\TriggerFactory;
use FireflyIII\Rules\Triggers\TriggerInterface;
use Log;
/**
@@ -89,17 +89,21 @@ class Processor
/**
* Checks whether the current transaction is triggered by the current rule
*
* @return boolean
*/
public function isTriggered() {
public function isTriggered()
{
return $this->triggered();
}
/**
* Checks whether the current transaction is triggered by the list of given triggers
*
* @return boolean
*/
public function isTriggeredBy(array $triggers) {
public function isTriggeredBy(array $triggers)
{
return $this->triggeredBy($triggers);
}
@@ -126,11 +130,23 @@ class Processor
}
/**
* Method to check whether the current transaction would be triggered
* by the given list of triggers
* Checks whether the current transaction is triggered by the current rule
*
* @return bool
*/
protected function triggeredBy($triggers) {
protected function triggered()
{
return $this->triggeredBy($this->rule->ruleTriggers()->orderBy('order', 'ASC')->get());
}
/**
* Method to check whether the current transaction would be triggered
* by the given list of triggers
*
* @return bool
*/
protected function triggeredBy($triggers)
{
$foundTriggers = 0;
$hitTriggers = 0;
/** @var RuleTrigger $trigger */
@@ -152,14 +168,6 @@ class Processor
return ($hitTriggers == $foundTriggers);
}
/**
* Checks whether the current transaction is triggered by the current rule
* @return bool
*/
protected function triggered()
{
return $this->triggeredBy($this->rule->ruleTriggers()->orderBy('order', 'ASC')->get());
}
}