Added method for triggers to check whether they match all transactions

This commit is contained in:
Robert Horlings 2016-02-17 13:02:27 +01:00
parent 17dad27610
commit 7c8c82edd7
18 changed files with 157 additions and 0 deletions

View File

@ -62,4 +62,11 @@ class AmountExactly implements TriggerInterface
return false;
}
/**
* Checks whether this trigger will match all transactions
* For example: amount > 0 or description starts with ''
* @return bool
*/
public function matchesAnything() { return false; }
}

View File

@ -62,4 +62,11 @@ class AmountLess implements TriggerInterface
return false;
}
/**
* Checks whether this trigger will match all transactions
* For example: amount > 0 or description starts with ''
* @return bool
*/
public function matchesAnything() { return false; }
}

View File

@ -62,4 +62,13 @@ class AmountMore implements TriggerInterface
return false;
}
/**
* Checks whether this trigger will match all transactions
* This happens when the trigger_value is zero
* @return bool
*/
public function matchesAnything() {
return bccomp('0', $this->trigger->trigger_value) === 0;
}
}

View File

@ -63,4 +63,13 @@ class DescriptionContains implements TriggerInterface
return false;
}
/**
* Checks whether this trigger will match all transactions
* This happens when the trigger_value is empty
* @return bool
*/
public function matchesAnything() {
return $this->trigger->trigger_value === "";
}
}

View File

@ -72,4 +72,14 @@ class DescriptionEnds implements TriggerInterface
return false;
}
/**
* Checks whether this trigger will match all transactions
* This happens when the trigger_value is empty
* @return bool
*/
public function matchesAnything() {
return $this->trigger->trigger_value === "";
}
}

View File

@ -58,4 +58,11 @@ class DescriptionIs implements TriggerInterface
return false;
}
/**
* Checks whether this trigger will match all transactions
* @return bool
*/
public function matchesAnything() { return false; }
}

View File

@ -60,4 +60,14 @@ class DescriptionStarts implements TriggerInterface
return false;
}
/**
* Checks whether this trigger will match all transactions
* This happens when the trigger_value is empty
* @return bool
*/
public function matchesAnything() {
return $this->trigger->trigger_value === "";
}
}

View File

@ -62,4 +62,14 @@ class FromAccountContains implements TriggerInterface
return false;
}
/**
* Checks whether this trigger will match all transactions
* This happens when the trigger_value is empty
* @return bool
*/
public function matchesAnything() {
return $this->trigger->trigger_value === "";
}
}

View File

@ -72,4 +72,15 @@ class FromAccountEnds implements TriggerInterface
return false;
}
/**
* Checks whether this trigger will match all transactions
* This happens when the trigger_value is empty
* @return bool
*/
public function matchesAnything() {
return $this->trigger->trigger_value === "";
}
}

View File

@ -58,4 +58,11 @@ class FromAccountIs implements TriggerInterface
return false;
}
/**
* Checks whether this trigger will match all transactions
* @return bool
*/
public function matchesAnything() { return false; }
}

View File

@ -60,4 +60,15 @@ class FromAccountStarts implements TriggerInterface
return false;
}
/**
* Checks whether this trigger will match all transactions
* This happens when the trigger_value is empty
* @return bool
*/
public function matchesAnything() {
return $this->trigger->trigger_value === "";
}
}

View File

@ -62,4 +62,15 @@ class ToAccountContains implements TriggerInterface
return false;
}
/**
* Checks whether this trigger will match all transactions
* This happens when the trigger_value is empty
* @return bool
*/
public function matchesAnything() {
return $this->trigger->trigger_value === "";
}
}

View File

@ -72,4 +72,14 @@ class ToAccountEnds implements TriggerInterface
return false;
}
/**
* Checks whether this trigger will match all transactions
* This happens when the trigger_value is empty
* @return bool
*/
public function matchesAnything() {
return $this->trigger->trigger_value === "";
}
}

View File

@ -58,4 +58,11 @@ class ToAccountIs implements TriggerInterface
return false;
}
/**
* Checks whether this trigger will match all transactions
* @return bool
*/
public function matchesAnything() { return false; }
}

View File

@ -60,4 +60,15 @@ class ToAccountStarts implements TriggerInterface
return false;
}
/**
* Checks whether this trigger will match all transactions
* This happens when the trigger_value is empty
* @return bool
*/
public function matchesAnything() {
return $this->trigger->trigger_value === "";
}
}

View File

@ -57,4 +57,11 @@ class TransactionType implements TriggerInterface
return false;
}
/**
* Checks whether this trigger will match all transactions
* @return bool
*/
public function matchesAnything() { return false; }
}

View File

@ -32,4 +32,11 @@ interface TriggerInterface
* @return bool
*/
public function triggered();
/**
* Checks whether this trigger will match all transactions
* For example: amount > 0 or description starts with ''
* @return bool
*/
public function matchesAnything();
}

View File

@ -53,4 +53,10 @@ class UserAction implements TriggerInterface
return true;
}
/**
* Checks whether this trigger will match all transactions
* @return bool
*/
public function matchesAnything() { return true; }
}