Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Add willMatchEveryThing as a static replacement for matchesAnything
James Colea6c318983350
diff --git a/app/Rules/Triggers/AmountExactly.php b/app/Rules/Triggers/AmountExactly.phpindex 03af0bec25..879d842681 100644--- a/app/Rules/Triggers/AmountExactly.php+++ b/app/Rules/Triggers/AmountExactly.php@@ -39,6 +39,31 @@ class AmountExactly implements TriggerInterface$this->journal = $journal;}+ /**+ * A trigger is said to "match anything", or match any given transaction,+ * when the trigger value is very vague or has no restrictions. Easy examples+ * are the "AmountMore"-trigger combined with an amount of 0: any given transaction+ * has an amount of more than zero! Other examples are all the "Description"-triggers+ * which have hard time handling empty trigger values such as "" or "*" (wild cards).+ *+ * If the user tries to create such a trigger, this method MUST return true so Firefly III+ * can stop the storing / updating the trigger. If the trigger is in any way restrictive+ * (even if it will still include 99.9% of the users transactions), this method MUST return+ * false.+ *+ * @param null $value+ *+ * @return bool+ */+ public static function willMatchEverything($value = null)+ {+ if (!is_null($value)) {+ return false;+ }++ return true;+ }+/*** @{inheritdoc}*diff --git a/app/Rules/Triggers/AmountLess.php b/app/Rules/Triggers/AmountLess.phpindex 5a9c72976b..d0719ff76d 100644--- a/app/Rules/Triggers/AmountLess.php+++ b/app/Rules/Triggers/AmountLess.php@@ -39,6 +39,31 @@ class AmountLess implements TriggerInterface$this->journal = $journal;}+ /**+ * A trigger is said to "match anything", or match any given transaction,+ * when the trigger value is very vague or has no restrictions. Easy examples+ * are the "AmountMore"-trigger combined with an amount of 0: any given transaction+ * has an amount of more than zero! Other examples are all the "Description"-triggers+ * which have hard time handling empty trigger values such as "" or "*" (wild cards).+ *+ * If the user tries to create such a trigger, this method MUST return true so Firefly III+ * can stop the storing / updating the trigger. If the trigger is in any way restrictive+ * (even if it will still include 99.9% of the users transactions), this method MUST return+ * false.+ *+ * @param null $value+ *+ * @return bool+ */+ public static function willMatchEverything($value = null)+ {+ if (!is_null($value)) {+ return false;+ }++ return true;+ }+/*** @{inheritdoc}*diff --git a/app/Rules/Triggers/AmountMore.php b/app/Rules/Triggers/AmountMore.phpindex 27ea6e02c3..ae5d86dc86 100644--- a/app/Rules/Triggers/AmountMore.php+++ b/app/Rules/Triggers/AmountMore.php@@ -39,6 +39,31 @@ class AmountMore implements TriggerInterface$this->journal = $journal;}+ /**+ * A trigger is said to "match anything", or match any given transaction,+ * when the trigger value is very vague or has no restrictions. Easy examples+ * are the "AmountMore"-trigger combined with an amount of 0: any given transaction+ * has an amount of more than zero! Other examples are all the "Description"-triggers+ * which have hard time handling empty trigger values such as "" or "*" (wild cards).+ *+ * If the user tries to create such a trigger, this method MUST return true so Firefly III+ * can stop the storing / updating the trigger. If the trigger is in any way restrictive+ * (even if it will still include 99.9% of the users transactions), this method MUST return+ * false.+ *+ * @param null $value+ *+ * @return bool+ */+ public static function willMatchEverything($value = null)+ {+ if (!is_null($value)) {+ return bccomp('0', strval($value)) === 0;+ }++ return true;+ }+/*** @{inheritdoc}*diff --git a/app/Rules/Triggers/DescriptionContains.php b/app/Rules/Triggers/DescriptionContains.phpindex e0949a60ee..9156ea4d74 100644--- a/app/Rules/Triggers/DescriptionContains.php+++ b/app/Rules/Triggers/DescriptionContains.php@@ -39,6 +39,31 @@ class DescriptionContains implements TriggerInterface$this->journal = $journal;}+ /**+ * A trigger is said to "match anything", or match any given transaction,+ * when the trigger value is very vague or has no restrictions. Easy examples+ * are the "AmountMore"-trigger combined with an amount of 0: any given transaction+ * has an amount of more than zero! Other examples are all the "Description"-triggers+ * which have hard time handling empty trigger values such as "" or "*" (wild cards).+ *+ * If the user tries to create such a trigger, this method MUST return true so Firefly III+ * can stop the storing / updating the trigger. If the trigger is in any way restrictive+ * (even if it will still include 99.9% of the users transactions), this method MUST return+ * false.+ *+ * @param null $value+ *+ * @return bool+ */+ public static function willMatchEverything($value = null)+ {+ if (!is_null($value)) {+ return strval($value) === "";+ }++ return true;+ }+/*** @{inheritdoc}*diff --git a/app/Rules/Triggers/DescriptionEnds.php b/app/Rules/Triggers/DescriptionEnds.phpindex 406fb385b9..bd0a8d0ce7 100644--- a/app/Rules/Triggers/DescriptionEnds.php+++ b/app/Rules/Triggers/DescriptionEnds.php@@ -38,6 +38,31 @@ class DescriptionEnds implements TriggerInterface$this->journal = $journal;}+ /**+ * A trigger is said to "match anything", or match any given transaction,+ * when the trigger value is very vague or has no restrictions. Easy examples+ * are the "AmountMore"-trigger combined with an amount of 0: any given transaction+ * has an amount of more than zero! Other examples are all the "Description"-triggers+ * which have hard time handling empty trigger values such as "" or "*" (wild cards).+ *+ * If the user tries to create such a trigger, this method MUST return true so Firefly III+ * can stop the storing / updating the trigger. If the trigger is in any way restrictive+ * (even if it will still include 99.9% of the users transactions), this method MUST return+ * false.+ *+ * @param null $value+ *+ * @return bool+ */+ public static function willMatchEverything($value = null)+ {+ if (!is_null($value)) {+ return strval($value) === "";+ }++ return true;+ }+/*** @{inheritdoc}*@@ -82,5 +107,4 @@ class DescriptionEnds implements TriggerInterfacereturn false;}-}diff --git a/app/Rules/Triggers/DescriptionIs.php b/app/Rules/Triggers/DescriptionIs.phpindex f6cedfd335..8f0b556b8d 100644--- a/app/Rules/Triggers/DescriptionIs.php+++ b/app/Rules/Triggers/DescriptionIs.php@@ -69,4 +69,28 @@ class DescriptionIs implements TriggerInterface}+ /**+ * A trigger is said to "match anything", or match any given transaction,+ * when the trigger value is very vague or has no restrictions. Easy examples+ * are the "AmountMore"-trigger combined with an amount of 0: any given transaction+ * has an amount of more than zero! Other examples are all the "Description"-triggers+ * which have hard time handling empty trigger values such as "" or "*" (wild cards).+ *+ * If the user tries to create such a trigger, this method MUST return true so Firefly III+ * can stop the storing / updating the trigger. If the trigger is in any way restrictive+ * (even if it will still include 99.9% of the users transactions), this method MUST return+ * false.+ *+ * @param null $value+ *+ * @return bool+ */+ public static function willMatchEverything($value = null)+ {+ if (!is_null($value)) {+ return false;+ }++ return true;+ }}diff --git a/app/Rules/Triggers/DescriptionStarts.php b/app/Rules/Triggers/DescriptionStarts.phpindex f5ad96953d..2d91dc01ad 100644--- a/app/Rules/Triggers/DescriptionStarts.php+++ b/app/Rules/Triggers/DescriptionStarts.php@@ -71,4 +71,28 @@ class DescriptionStarts implements TriggerInterface}+ /**+ * A trigger is said to "match anything", or match any given transaction,+ * when the trigger value is very vague or has no restrictions. Easy examples+ * are the "AmountMore"-trigger combined with an amount of 0: any given transaction+ * has an amount of more than zero! Other examples are all the "Description"-triggers+ * which have hard time handling empty trigger values such as "" or "*" (wild cards).+ *+ * If the user tries to create such a trigger, this method MUST return true so Firefly III+ * can stop the storing / updating the trigger. If the trigger is in any way restrictive+ * (even if it will still include 99.9% of the users transactions), this method MUST return+ * false.+ *+ * @param null $value+ *+ * @return bool+ */+ public static function willMatchEverything($value = null)+ {+ if (!is_null($value)) {+ return strval($value) === "";+ }++ return true;+ }}diff --git a/app/Rules/Triggers/FromAccountContains.php b/app/Rules/Triggers/FromAccountContains.phpindex c7e28041ba..d5a2113288 100644--- a/app/Rules/Triggers/FromAccountContains.php+++ b/app/Rules/Triggers/FromAccountContains.php@@ -73,4 +73,28 @@ class FromAccountContains implements TriggerInterface}+ /**+ * A trigger is said to "match anything", or match any given transaction,+ * when the trigger value is very vague or has no restrictions. Easy examples+ * are the "AmountMore"-trigger combined with an amount of 0: any given transaction+ * has an amount of more than zero! Other examples are all the "Description"-triggers+ * which have hard time handling empty trigger values such as "" or "*" (wild cards).+ *+ * If the user tries to create such a trigger, this method MUST return true so Firefly III+ * can stop the storing / updating the trigger. If the trigger is in any way restrictive+ * (even if it will still include 99.9% of the users transactions), this method MUST return+ * false.+ *+ * @param null $value+ *+ * @return bool+ */+ public static function willMatchEverything($value = null)+ {+ if (!is_null($value)) {+ return strval($value) === "";+ }++ return true;+ }}diff --git a/app/Rules/Triggers/FromAccountEnds.php b/app/Rules/Triggers/FromAccountEnds.phpindex 79659fad98..617f7eb037 100644--- a/app/Rules/Triggers/FromAccountEnds.php+++ b/app/Rules/Triggers/FromAccountEnds.php@@ -83,4 +83,28 @@ class FromAccountEnds implements TriggerInterface}+ /**+ * A trigger is said to "match anything", or match any given transaction,+ * when the trigger value is very vague or has no restrictions. Easy examples+ * are the "AmountMore"-trigger combined with an amount of 0: any given transaction+ * has an amount of more than zero! Other examples are all the "Description"-triggers+ * which have hard time handling empty trigger values such as "" or "*" (wild cards).+ *+ * If the user tries to create such a trigger, this method MUST return true so Firefly III+ * can stop the storing / updating the trigger. If the trigger is in any way restrictive+ * (even if it will still include 99.9% of the users transactions), this method MUST return+ * false.+ *+ * @param null $value+ *+ * @return bool+ */+ public static function willMatchEverything($value = null)+ {+ if (!is_null($value)) {+ return strval($value) === "";+ }++ return true;+ }}diff --git a/app/Rules/Triggers/FromAccountIs.php b/app/Rules/Triggers/FromAccountIs.phpindex 07265484f8..7f73fc6e9f 100644--- a/app/Rules/Triggers/FromAccountIs.php+++ b/app/Rules/Triggers/FromAccountIs.php@@ -38,6 +38,31 @@ class FromAccountIs implements TriggerInterface$this->journal = $journal;}+ /**+ * A trigger is said to "match anything", or match any given transaction,+ * when the trigger value is very vague or has no restrictions. Easy examples+ * are the "AmountMore"-trigger combined with an amount of 0: any given transaction+ * has an amount of more than zero! Other examples are all the "Description"-triggers+ * which have hard time handling empty trigger values such as "" or "*" (wild cards).+ *+ * If the user tries to create such a trigger, this method MUST return true so Firefly III+ * can stop the storing / updating the trigger. If the trigger is in any way restrictive+ * (even if it will still include 99.9% of the users transactions), this method MUST return+ * false.+ *+ * @param null $value+ *+ * @return bool+ */+ public static function willMatchEverything($value = null)+ {+ if (!is_null($value)) {+ return false;+ }++ return true;+ }+/*** @{inheritdoc}*@@ -68,5 +93,4 @@ class FromAccountIs implements TriggerInterfacereturn false;}-}diff --git a/app/Rules/Triggers/FromAccountStarts.php b/app/Rules/Triggers/FromAccountStarts.phpindex 7588769ed4..954711de95 100644--- a/app/Rules/Triggers/FromAccountStarts.php+++ b/app/Rules/Triggers/FromAccountStarts.php@@ -38,6 +38,31 @@ class FromAccountStarts implements TriggerInterface$this->journal = $journal;}+ /**+ * A trigger is said to "match anything", or match any given transaction,+ * when the trigger value is very vague or has no restrictions. Easy examples+ * are the "AmountMore"-trigger combined with an amount of 0: any given transaction+ * has an amount of more than zero! Other examples are all the "Description"-triggers+ * which have hard time handling empty trigger values such as "" or "*" (wild cards).+ *+ * If the user tries to create such a trigger, this method MUST return true so Firefly III+ * can stop the storing / updating the trigger. If the trigger is in any way restrictive+ * (even if it will still include 99.9% of the users transactions), this method MUST return+ * false.+ *+ * @param null $value+ *+ * @return bool+ */+ public static function willMatchEverything($value = null)+ {+ if (!is_null($value)) {+ return strval($value) === "";+ }++ return true;+ }+/*** @{inheritdoc}*@@ -70,5 +95,4 @@ class FromAccountStarts implements TriggerInterfacereturn false;}-}diff --git a/app/Rules/Triggers/ToAccountContains.php b/app/Rules/Triggers/ToAccountContains.phpindex b55d592bec..e0f826a6e4 100644--- a/app/Rules/Triggers/ToAccountContains.php+++ b/app/Rules/Triggers/ToAccountContains.php@@ -73,4 +73,29 @@ class ToAccountContains implements TriggerInterface}++ /**+ * A trigger is said to "match anything", or match any given transaction,+ * when the trigger value is very vague or has no restrictions. Easy examples+ * are the "AmountMore"-trigger combined with an amount of 0: any given transaction+ * has an amount of more than zero! Other examples are all the "Description"-triggers+ * which have hard time handling empty trigger values such as "" or "*" (wild cards).+ *+ * If the user tries to create such a trigger, this method MUST return true so Firefly III+ * can stop the storing / updating the trigger. If the trigger is in any way restrictive+ * (even if it will still include 99.9% of the users transactions), this method MUST return+ * false.+ *+ * @param null $value+ *+ * @return bool+ */+ public static function willMatchEverything($value = null)+ {+ if (!is_null($value)) {+ return strval($value) === "";+ }++ return true;+ }}diff --git a/app/Rules/Triggers/ToAccountEnds.php b/app/Rules/Triggers/ToAccountEnds.phpindex 0dc9d757c8..1c8bf21eb7 100644--- a/app/Rules/Triggers/ToAccountEnds.php+++ b/app/Rules/Triggers/ToAccountEnds.php@@ -82,4 +82,29 @@ class ToAccountEnds implements TriggerInterfacereturn false;}++ /**+ * A trigger is said to "match anything", or match any given transaction,+ * when the trigger value is very vague or has no restrictions. Easy examples+ * are the "AmountMore"-trigger combined with an amount of 0: any given transaction+ * has an amount of more than zero! Other examples are all the "Description"-triggers+ * which have hard time handling empty trigger values such as "" or "*" (wild cards).+ *+ * If the user tries to create such a trigger, this method MUST return true so Firefly III+ * can stop the storing / updating the trigger. If the trigger is in any way restrictive+ * (even if it will still include 99.9% of the users transactions), this method MUST return+ * false.+ *+ * @param null $value+ *+ * @return bool+ */+ public static function willMatchEverything($value = null)+ {+ if (!is_null($value)) {+ return strval($value) === "";+ }++ return true;+ }}diff --git a/app/Rules/Triggers/ToAccountIs.php b/app/Rules/Triggers/ToAccountIs.phpindex 1d389ca5dd..b5a39b752c 100644--- a/app/Rules/Triggers/ToAccountIs.php+++ b/app/Rules/Triggers/ToAccountIs.php@@ -69,4 +69,28 @@ class ToAccountIs implements TriggerInterface}+ /**+ * A trigger is said to "match anything", or match any given transaction,+ * when the trigger value is very vague or has no restrictions. Easy examples+ * are the "AmountMore"-trigger combined with an amount of 0: any given transaction+ * has an amount of more than zero! Other examples are all the "Description"-triggers+ * which have hard time handling empty trigger values such as "" or "*" (wild cards).+ *+ * If the user tries to create such a trigger, this method MUST return true so Firefly III+ * can stop the storing / updating the trigger. If the trigger is in any way restrictive+ * (even if it will still include 99.9% of the users transactions), this method MUST return+ * false.+ *+ * @param null $value+ *+ * @return bool+ */+ public static function willMatchEverything($value = null)+ {+ if (!is_null($value)) {+ return false;+ }++ return true;+ }}diff --git a/app/Rules/Triggers/ToAccountStarts.php b/app/Rules/Triggers/ToAccountStarts.phpindex e9d5b8caa7..78fc07c77a 100644--- a/app/Rules/Triggers/ToAccountStarts.php+++ b/app/Rules/Triggers/ToAccountStarts.php@@ -71,4 +71,28 @@ class ToAccountStarts implements TriggerInterface}+ /**+ * A trigger is said to "match anything", or match any given transaction,+ * when the trigger value is very vague or has no restrictions. Easy examples+ * are the "AmountMore"-trigger combined with an amount of 0: any given transaction+ * has an amount of more than zero! Other examples are all the "Description"-triggers+ * which have hard time handling empty trigger values such as "" or "*" (wild cards).+ *+ * If the user tries to create such a trigger, this method MUST return true so Firefly III+ * can stop the storing / updating the trigger. If the trigger is in any way restrictive+ * (even if it will still include 99.9% of the users transactions), this method MUST return+ * false.+ *+ * @param null $value+ *+ * @return bool+ */+ public static function willMatchEverything($value = null)+ {+ if (!is_null($value)) {+ return strval($value) === "";+ }++ return true;+ }}diff --git a/app/Rules/Triggers/TransactionType.php b/app/Rules/Triggers/TransactionType.phpindex 4a47604a66..1beb3478d6 100644--- a/app/Rules/Triggers/TransactionType.php+++ b/app/Rules/Triggers/TransactionType.php@@ -68,4 +68,28 @@ class TransactionType implements TriggerInterfacereturn false;}+ /**+ * A trigger is said to "match anything", or match any given transaction,+ * when the trigger value is very vague or has no restrictions. Easy examples+ * are the "AmountMore"-trigger combined with an amount of 0: any given transaction+ * has an amount of more than zero! Other examples are all the "Description"-triggers+ * which have hard time handling empty trigger values such as "" or "*" (wild cards).+ *+ * If the user tries to create such a trigger, this method MUST return true so Firefly III+ * can stop the storing / updating the trigger. If the trigger is in any way restrictive+ * (even if it will still include 99.9% of the users transactions), this method MUST return+ * false.+ *+ * @param null $value+ *+ * @return bool+ */+ public static function willMatchEverything($value = null)+ {+ if (!is_null($value)) {+ return false;+ }++ return true;+ }}diff --git a/app/Rules/Triggers/TriggerInterface.php b/app/Rules/Triggers/TriggerInterface.phpindex 2c8f61f4f8..355a03d9e0 100644--- a/app/Rules/Triggers/TriggerInterface.php+++ b/app/Rules/Triggers/TriggerInterface.php@@ -28,6 +28,24 @@ interface TriggerInterface*/public function __construct(RuleTrigger $trigger, TransactionJournal $journal);+ /**+ * A trigger is said to "match anything", or match any given transaction,+ * when the trigger value is very vague or has no restrictions. Easy examples+ * are the "AmountMore"-trigger combined with an amount of 0: any given transaction+ * has an amount of more than zero! Other examples are all the "Description"-triggers+ * which have hard time handling empty trigger values such as "" or "*" (wild cards).+ *+ * If the user tries to create such a trigger, this method MUST return true so Firefly III+ * can stop the storing / updating the trigger. If the trigger is in any way restrictive+ * (even if it will still include 99.9% of the users transactions), this method MUST return+ * false.+ *+ * @param null $value+ *+ * @return bool+ */+ public static function willMatchEverything($value = null);+/*** A trigger is said to "match anything", or match any given transaction,* when the trigger value is very vague or has no restrictions. Easy examplesdiff --git a/app/Rules/Triggers/UserAction.php b/app/Rules/Triggers/UserAction.phpindex c9fdcc78a2..a2acb3c1f7 100644--- a/app/Rules/Triggers/UserAction.php+++ b/app/Rules/Triggers/UserAction.php@@ -39,6 +39,27 @@ class UserAction implements TriggerInterface}+ /**+ * A trigger is said to "match anything", or match any given transaction,+ * when the trigger value is very vague or has no restrictions. Easy examples+ * are the "AmountMore"-trigger combined with an amount of 0: any given transaction+ * has an amount of more than zero! Other examples are all the "Description"-triggers+ * which have hard time handling empty trigger values such as "" or "*" (wild cards).+ *+ * If the user tries to create such a trigger, this method MUST return true so Firefly III+ * can stop the storing / updating the trigger. If the trigger is in any way restrictive+ * (even if it will still include 99.9% of the users transactions), this method MUST return+ * false.+ *+ * @param null $value+ *+ * @return bool+ */+ public static function willMatchEverything($value = null)+ {+ return true;+ }+/*** @{inheritdoc}*@@ -62,5 +83,4 @@ class UserAction implements TriggerInterfacereturn true;}-}