Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Code cleanup. [skip ci]
James Cole0d44f82c864c
diff --git a/app/Rules/Triggers/AmountExactly.php b/app/Rules/Triggers/AmountExactly.phpindex a9e13cf388..03af0bec25 100644--- a/app/Rules/Triggers/AmountExactly.php+++ b/app/Rules/Triggers/AmountExactly.php@@ -22,12 +22,10 @@ use Log;*/class AmountExactly implements TriggerInterface{- /** @var RuleTrigger */- protected $trigger;-/** @var TransactionJournal */protected $journal;-+ /** @var RuleTrigger */+ protected $trigger;/*** TriggerInterface constructor.@@ -41,6 +39,18 @@ class AmountExactly implements TriggerInterface$this->journal = $journal;}+ /**+ * @{inheritdoc}+ *+ * @see TriggerInterface::matchesAnything+ *+ * @return bool+ */+ public function matchesAnything()+ {+ return false;+ }+/*** @return bool*/@@ -62,16 +72,4 @@ class AmountExactly implements TriggerInterfacereturn false;}-- /**- * @{inheritdoc}- *- * @see TriggerInterface::matchesAnything- *- * @return bool- */- public function matchesAnything()- {- return false;- }}diff --git a/app/Rules/Triggers/AmountLess.php b/app/Rules/Triggers/AmountLess.phpindex 29e38e181b..5a9c72976b 100644--- a/app/Rules/Triggers/AmountLess.php+++ b/app/Rules/Triggers/AmountLess.php@@ -22,12 +22,10 @@ use Log;*/class AmountLess implements TriggerInterface{- /** @var RuleTrigger */- protected $trigger;-/** @var TransactionJournal */protected $journal;-+ /** @var RuleTrigger */+ protected $trigger;/*** TriggerInterface constructor.@@ -41,6 +39,18 @@ class AmountLess implements TriggerInterface$this->journal = $journal;}+ /**+ * @{inheritdoc}+ *+ * @see TriggerInterface::matchesAnything+ *+ * @return bool+ */+ public function matchesAnything()+ {+ return false;+ }+/*** @return bool*/@@ -62,16 +72,4 @@ class AmountLess implements TriggerInterfacereturn false;}-- /**- * @{inheritdoc}- *- * @see TriggerInterface::matchesAnything- *- * @return bool- */- public function matchesAnything()- {- return false;- }}diff --git a/app/Rules/Triggers/AmountMore.php b/app/Rules/Triggers/AmountMore.phpindex 583d893ddc..27ea6e02c3 100644--- a/app/Rules/Triggers/AmountMore.php+++ b/app/Rules/Triggers/AmountMore.php@@ -22,12 +22,10 @@ use Log;*/class AmountMore implements TriggerInterface{- /** @var RuleTrigger */- protected $trigger;-/** @var TransactionJournal */protected $journal;-+ /** @var RuleTrigger */+ protected $trigger;/*** TriggerInterface constructor.@@ -41,6 +39,18 @@ class AmountMore implements TriggerInterface$this->journal = $journal;}+ /**+ * @{inheritdoc}+ *+ * @see TriggerInterface::matchesAnything+ *+ * @return bool+ */+ public function matchesAnything()+ {+ return bccomp('0', $this->trigger->trigger_value) === 0;+ }+/*** @return bool*/@@ -62,16 +72,4 @@ class AmountMore implements TriggerInterfacereturn false;}-- /**- * @{inheritdoc}- *- * @see TriggerInterface::matchesAnything- *- * @return bool- */- public function matchesAnything()- {- return bccomp('0', $this->trigger->trigger_value) === 0;- }}diff --git a/app/Rules/Triggers/DescriptionContains.php b/app/Rules/Triggers/DescriptionContains.phpindex cd639078c0..e0949a60ee 100644--- a/app/Rules/Triggers/DescriptionContains.php+++ b/app/Rules/Triggers/DescriptionContains.php@@ -22,12 +22,10 @@ use Log;*/class DescriptionContains implements TriggerInterface{- /** @var RuleTrigger */- protected $trigger;-/** @var TransactionJournal */protected $journal;-+ /** @var RuleTrigger */+ protected $trigger;/*** TriggerInterface constructor.@@ -41,6 +39,18 @@ class DescriptionContains implements TriggerInterface$this->journal = $journal;}+ /**+ * @{inheritdoc}+ *+ * @see TriggerInterface::matchesAnything+ *+ * @return bool+ */+ public function matchesAnything()+ {+ return $this->trigger->trigger_value === "";+ }+/*** @return bool*/@@ -63,16 +73,4 @@ class DescriptionContains implements TriggerInterfacereturn false;}-- /**- * @{inheritdoc}- *- * @see TriggerInterface::matchesAnything- *- * @return bool- */- public function matchesAnything()- {- return $this->trigger->trigger_value === "";- }}diff --git a/app/Rules/Triggers/DescriptionEnds.php b/app/Rules/Triggers/DescriptionEnds.phpindex 0eb3c99f83..406fb385b9 100644--- a/app/Rules/Triggers/DescriptionEnds.php+++ b/app/Rules/Triggers/DescriptionEnds.php@@ -21,12 +21,10 @@ use Log;*/class DescriptionEnds implements TriggerInterface{- /** @var RuleTrigger */- protected $trigger;-/** @var TransactionJournal */protected $journal;-+ /** @var RuleTrigger */+ protected $trigger;/*** TriggerInterface constructor.@@ -40,6 +38,18 @@ class DescriptionEnds implements TriggerInterface$this->journal = $journal;}+ /**+ * @{inheritdoc}+ *+ * @see TriggerInterface::matchesAnything+ *+ * @return bool+ */+ public function matchesAnything()+ {+ return $this->trigger->trigger_value === "";+ }+/*** @return bool*/@@ -73,16 +83,4 @@ class DescriptionEnds implements TriggerInterface}- /**- * @{inheritdoc}- *- * @see TriggerInterface::matchesAnything- *- * @return bool- */- public function matchesAnything()- {- return $this->trigger->trigger_value === "";- }-}diff --git a/app/Rules/Triggers/DescriptionIs.php b/app/Rules/Triggers/DescriptionIs.phpindex 5d1011bf6a..f6cedfd335 100644--- a/app/Rules/Triggers/DescriptionIs.php+++ b/app/Rules/Triggers/DescriptionIs.php@@ -21,12 +21,10 @@ use Log;*/class DescriptionIs implements TriggerInterface{- /** @var RuleTrigger */- protected $trigger;-/** @var TransactionJournal */protected $journal;-+ /** @var RuleTrigger */+ protected $trigger;/*** TriggerInterface constructor.@@ -40,6 +38,18 @@ class DescriptionIs implements TriggerInterface$this->journal = $journal;}+ /**+ * @{inheritdoc}+ *+ * @see TriggerInterface::matchesAnything+ *+ * @return bool+ */+ public function matchesAnything()+ {+ return false;+ }+/*** @return bool*/@@ -59,16 +69,4 @@ class DescriptionIs implements TriggerInterface}- /**- * @{inheritdoc}- *- * @see TriggerInterface::matchesAnything- *- * @return bool- */- public function matchesAnything()- {- return false;- }-}diff --git a/app/Rules/Triggers/FromAccountContains.php b/app/Rules/Triggers/FromAccountContains.phpindex e7bd31ed5d..c7e28041ba 100644--- a/app/Rules/Triggers/FromAccountContains.php+++ b/app/Rules/Triggers/FromAccountContains.php@@ -21,12 +21,10 @@ use Log;*/class FromAccountContains implements TriggerInterface{- /** @var RuleTrigger */- protected $trigger;-/** @var TransactionJournal */protected $journal;-+ /** @var RuleTrigger */+ protected $trigger;/*** TriggerInterface constructor.@@ -40,6 +38,18 @@ class FromAccountContains implements TriggerInterface$this->journal = $journal;}+ /**+ * @{inheritdoc}+ *+ * @see TriggerInterface::matchesAnything+ *+ * @return bool+ */+ public function matchesAnything()+ {+ return $this->trigger->trigger_value === "";+ }+/*** @return bool*/@@ -63,16 +73,4 @@ class FromAccountContains implements TriggerInterface}- /**- * @{inheritdoc}- *- * @see TriggerInterface::matchesAnything- *- * @return bool- */- public function matchesAnything()- {- return $this->trigger->trigger_value === "";- }-}diff --git a/app/Rules/Triggers/FromAccountEnds.php b/app/Rules/Triggers/FromAccountEnds.phpindex bba52c85c5..79659fad98 100644--- a/app/Rules/Triggers/FromAccountEnds.php+++ b/app/Rules/Triggers/FromAccountEnds.php@@ -21,12 +21,10 @@ use Log;*/class FromAccountEnds implements TriggerInterface{- /** @var RuleTrigger */- protected $trigger;-/** @var TransactionJournal */protected $journal;-+ /** @var RuleTrigger */+ protected $trigger;/*** TriggerInterface constructor.@@ -40,6 +38,18 @@ class FromAccountEnds implements TriggerInterface$this->journal = $journal;}+ /**+ * @{inheritdoc}+ *+ * @see TriggerInterface::matchesAnything+ *+ * @return bool+ */+ public function matchesAnything()+ {+ return $this->trigger->trigger_value === "";+ }+/*** @return bool*/@@ -73,17 +83,4 @@ class FromAccountEnds implements TriggerInterface}-- /**- * @{inheritdoc}- *- * @see TriggerInterface::matchesAnything- *- * @return bool- */- public function matchesAnything()- {- return $this->trigger->trigger_value === "";- }-}diff --git a/app/Rules/Triggers/FromAccountIs.php b/app/Rules/Triggers/FromAccountIs.phpindex 90d38ca6d9..07265484f8 100644--- a/app/Rules/Triggers/FromAccountIs.php+++ b/app/Rules/Triggers/FromAccountIs.php@@ -21,12 +21,10 @@ use Log;*/class FromAccountIs implements TriggerInterface{- /** @var RuleTrigger */- protected $trigger;-/** @var TransactionJournal */protected $journal;-+ /** @var RuleTrigger */+ protected $trigger;/*** TriggerInterface constructor.@@ -40,6 +38,18 @@ class FromAccountIs implements TriggerInterface$this->journal = $journal;}+ /**+ * @{inheritdoc}+ *+ * @see TriggerInterface::matchesAnything+ *+ * @return bool+ */+ public function matchesAnything()+ {+ return false;+ }+/*** @return bool*/@@ -59,16 +69,4 @@ class FromAccountIs implements TriggerInterface}- /**- * @{inheritdoc}- *- * @see TriggerInterface::matchesAnything- *- * @return bool- */- public function matchesAnything()- {- return false;- }-}diff --git a/app/Rules/Triggers/FromAccountStarts.php b/app/Rules/Triggers/FromAccountStarts.phpindex 43a8f5b7a0..7588769ed4 100644--- a/app/Rules/Triggers/FromAccountStarts.php+++ b/app/Rules/Triggers/FromAccountStarts.php@@ -21,12 +21,10 @@ use Log;*/class FromAccountStarts implements TriggerInterface{- /** @var RuleTrigger */- protected $trigger;-/** @var TransactionJournal */protected $journal;-+ /** @var RuleTrigger */+ protected $trigger;/*** TriggerInterface constructor.@@ -40,6 +38,18 @@ class FromAccountStarts implements TriggerInterface$this->journal = $journal;}+ /**+ * @{inheritdoc}+ *+ * @see TriggerInterface::matchesAnything+ *+ * @return bool+ */+ public function matchesAnything()+ {+ return $this->trigger->trigger_value === "";+ }+/*** @return bool*/@@ -61,17 +71,4 @@ class FromAccountStarts implements TriggerInterface}-- /**- * @{inheritdoc}- *- * @see TriggerInterface::matchesAnything- *- * @return bool- */- public function matchesAnything()- {- return $this->trigger->trigger_value === "";- }-}diff --git a/app/Rules/Triggers/ToAccountContains.php b/app/Rules/Triggers/ToAccountContains.phpindex c219437e8b..b55d592bec 100644--- a/app/Rules/Triggers/ToAccountContains.php+++ b/app/Rules/Triggers/ToAccountContains.php@@ -21,12 +21,10 @@ use Log;*/class ToAccountContains implements TriggerInterface{- /** @var RuleTrigger */- protected $trigger;-/** @var TransactionJournal */protected $journal;-+ /** @var RuleTrigger */+ protected $trigger;/*** TriggerInterface constructor.@@ -40,6 +38,18 @@ class ToAccountContains implements TriggerInterface$this->journal = $journal;}+ /**+ * @{inheritdoc}+ *+ * @see TriggerInterface::matchesAnything+ *+ * @return bool+ */+ public function matchesAnything()+ {+ return $this->trigger->trigger_value === "";+ }+/*** @return bool*/@@ -63,17 +73,4 @@ class ToAccountContains implements TriggerInterface}-- /**- * @{inheritdoc}- *- * @see TriggerInterface::matchesAnything- *- * @return bool- */- public function matchesAnything()- {- return $this->trigger->trigger_value === "";- }-}diff --git a/app/Rules/Triggers/ToAccountEnds.php b/app/Rules/Triggers/ToAccountEnds.phpindex 5591ffcca8..0dc9d757c8 100644--- a/app/Rules/Triggers/ToAccountEnds.php+++ b/app/Rules/Triggers/ToAccountEnds.php@@ -21,12 +21,10 @@ use Log;*/class ToAccountEnds implements TriggerInterface{- /** @var RuleTrigger */- protected $trigger;-/** @var TransactionJournal */protected $journal;-+ /** @var RuleTrigger */+ protected $trigger;/*** TriggerInterface constructor.@@ -40,6 +38,18 @@ class ToAccountEnds implements TriggerInterface$this->journal = $journal;}+ /**+ * @{inheritdoc}+ *+ * @see TriggerInterface::matchesAnything+ *+ * @return bool+ */+ public function matchesAnything()+ {+ return $this->trigger->trigger_value === "";+ }+/*** @return bool*/@@ -72,17 +82,4 @@ class ToAccountEnds implements TriggerInterfacereturn false;}--- /**- * @{inheritdoc}- *- * @see TriggerInterface::matchesAnything- *- * @return bool- */- public function matchesAnything()- {- return $this->trigger->trigger_value === "";- }}diff --git a/app/Rules/Triggers/ToAccountIs.php b/app/Rules/Triggers/ToAccountIs.phpindex 4596ef9fde..1d389ca5dd 100644--- a/app/Rules/Triggers/ToAccountIs.php+++ b/app/Rules/Triggers/ToAccountIs.php@@ -21,12 +21,10 @@ use Log;*/class ToAccountIs implements TriggerInterface{- /** @var RuleTrigger */- protected $trigger;-/** @var TransactionJournal */protected $journal;-+ /** @var RuleTrigger */+ protected $trigger;/*** TriggerInterface constructor.@@ -40,6 +38,18 @@ class ToAccountIs implements TriggerInterface$this->journal = $journal;}+ /**+ * @{inheritdoc}+ *+ * @see TriggerInterface::matchesAnything+ *+ * @return bool+ */+ public function matchesAnything()+ {+ return false;+ }+/*** @return bool*/@@ -59,16 +69,4 @@ class ToAccountIs implements TriggerInterface}- /**- * @{inheritdoc}- *- * @see TriggerInterface::matchesAnything- *- * @return bool- */- public function matchesAnything()- {- return false;- }-}diff --git a/app/Rules/Triggers/ToAccountStarts.php b/app/Rules/Triggers/ToAccountStarts.phpindex d4423e931a..e9d5b8caa7 100644--- a/app/Rules/Triggers/ToAccountStarts.php+++ b/app/Rules/Triggers/ToAccountStarts.php@@ -21,12 +21,10 @@ use Log;*/class ToAccountStarts implements TriggerInterface{- /** @var RuleTrigger */- protected $trigger;-/** @var TransactionJournal */protected $journal;-+ /** @var RuleTrigger */+ protected $trigger;/*** TriggerInterface constructor.@@ -40,6 +38,18 @@ class ToAccountStarts implements TriggerInterface$this->journal = $journal;}+ /**+ * @{inheritdoc}+ *+ * @see TriggerInterface::matchesAnything+ *+ * @return bool+ */+ public function matchesAnything()+ {+ return $this->trigger->trigger_value === "";+ }+/*** @return bool*/@@ -61,17 +71,4 @@ class ToAccountStarts implements TriggerInterface}-- /**- * @{inheritdoc}- *- * @see TriggerInterface::matchesAnything- *- * @return bool- */- public function matchesAnything()- {- return $this->trigger->trigger_value === "";- }-}diff --git a/app/Rules/Triggers/TransactionType.php b/app/Rules/Triggers/TransactionType.phpindex 3a06c13f30..4a47604a66 100644--- a/app/Rules/Triggers/TransactionType.php+++ b/app/Rules/Triggers/TransactionType.php@@ -21,12 +21,10 @@ use Log;*/class TransactionType implements TriggerInterface{- /** @var RuleTrigger */- protected $trigger;-/** @var TransactionJournal */protected $journal;-+ /** @var RuleTrigger */+ protected $trigger;/*** TriggerInterface constructor.@@ -40,6 +38,18 @@ class TransactionType implements TriggerInterface$this->journal = $journal;}+ /**+ * @{inheritdoc}+ *+ * @see TriggerInterface::matchesAnything+ *+ * @return bool+ */+ public function matchesAnything()+ {+ return false;+ }+/*** @return bool*/@@ -58,16 +68,4 @@ class TransactionType implements TriggerInterfacereturn false;}- /**- * @{inheritdoc}- *- * @see TriggerInterface::matchesAnything- *- * @return bool- */- public function matchesAnything()- {- return false;- }-}diff --git a/app/Rules/Triggers/TriggerFactory.php b/app/Rules/Triggers/TriggerFactory.phpindex 157861889c..116670e9ff 100644--- a/app/Rules/Triggers/TriggerFactory.php+++ b/app/Rules/Triggers/TriggerFactory.php@@ -23,6 +23,22 @@ class TriggerFactory{protected static $triggerTypes = null;+ /**+ * Returns the trigger for the given type and journal+ *+ * @param RuleTrigger $trigger+ * @param TransactionJournal $journal+ *+ * @return TriggerInterface+ */+ public static function getTrigger(RuleTrigger $trigger, TransactionJournal $journal): TriggerInterface+ {+ $triggerType = $trigger->trigger_type;+ $class = self::getTriggerClass($triggerType);++ return new $class($trigger, $journal);+ }+/*** Returns the class name to be used for triggers with the given name*@@ -47,22 +63,6 @@ class TriggerFactoryreturn $class;}- /**- * Returns the trigger for the given type and journal- *- * @param RuleTrigger $trigger- * @param TransactionJournal $journal- *- * @return TriggerInterface- */- public static function getTrigger(RuleTrigger $trigger, TransactionJournal $journal): TriggerInterface- {- $triggerType = $trigger->trigger_type;- $class = self::getTriggerClass($triggerType);-- return new $class($trigger, $journal);- }-/*** Returns a map with triggertypes, mapped to the class representing that type*/diff --git a/app/Rules/Triggers/UserAction.php b/app/Rules/Triggers/UserAction.phpindex 55ab4dbfda..c9fdcc78a2 100644--- a/app/Rules/Triggers/UserAction.php+++ b/app/Rules/Triggers/UserAction.php@@ -21,12 +21,10 @@ use Log;*/class UserAction implements TriggerInterface{- /** @var RuleTrigger */- protected $trigger;-/** @var TransactionJournal */protected $journal;-+ /** @var RuleTrigger */+ protected $trigger;/*** TriggerInterface constructor.@@ -42,26 +40,26 @@ class UserAction implements TriggerInterface}/**- * This trigger is always triggered, because the rule that it is a part of has been pre-selected on this condition.+ * @{inheritdoc}+ *+ * @see TriggerInterface::matchesAnything** @return bool*/- public function triggered()+ public function matchesAnything(){- Log::debug('user_action always returns true.');-return true;}/**- * @{inheritdoc}- *- * @see TriggerInterface::matchesAnything+ * This trigger is always triggered, because the rule that it is a part of has been pre-selected on this condition.** @return bool*/- public function matchesAnything()+ public function triggered(){+ Log::debug('user_action always returns true.');+return true;}