Better description for matchesAnything

This commit is contained in:
James Cole 2016-02-17 15:37:05 +01:00
parent 52481a6e8b
commit 9cac61dc33
19 changed files with 73 additions and 44 deletions

View File

@ -64,8 +64,9 @@ class AmountExactly implements TriggerInterface
}
/**
* Checks whether this trigger will match all transactions
* For example: amount > 0 or description starts with ''
* @{inheritdoc}
*
* @see TriggerInterface::matchesAnything
*
* @return bool
*/

View File

@ -64,8 +64,9 @@ class AmountLess implements TriggerInterface
}
/**
* Checks whether this trigger will match all transactions
* For example: amount > 0 or description starts with ''
* @{inheritdoc}
*
* @see TriggerInterface::matchesAnything
*
* @return bool
*/

View File

@ -64,8 +64,9 @@ class AmountMore implements TriggerInterface
}
/**
* Checks whether this trigger will match all transactions
* This happens when the trigger_value is zero
* @{inheritdoc}
*
* @see TriggerInterface::matchesAnything
*
* @return bool
*/

View File

@ -65,8 +65,9 @@ class DescriptionContains implements TriggerInterface
}
/**
* Checks whether this trigger will match all transactions
* This happens when the trigger_value is empty
* @{inheritdoc}
*
* @see TriggerInterface::matchesAnything
*
* @return bool
*/

View File

@ -74,8 +74,9 @@ class DescriptionEnds implements TriggerInterface
}
/**
* Checks whether this trigger will match all transactions
* This happens when the trigger_value is empty
* @{inheritdoc}
*
* @see TriggerInterface::matchesAnything
*
* @return bool
*/

View File

@ -60,7 +60,9 @@ class DescriptionIs implements TriggerInterface
}
/**
* Checks whether this trigger will match all transactions
* @{inheritdoc}
*
* @see TriggerInterface::matchesAnything
*
* @return bool
*/

View File

@ -21,12 +21,10 @@ use Log;
*/
class DescriptionStarts implements TriggerInterface
{
/** @var RuleTrigger */
protected $trigger;
/** @var TransactionJournal */
protected $journal;
/** @var RuleTrigger */
protected $trigger;
/**
* TriggerInterface constructor.
@ -40,6 +38,18 @@ class DescriptionStarts implements TriggerInterface
$this->journal = $journal;
}
/**
* @{inheritdoc}
*
* @see TriggerInterface::matchesAnything
*
* @return bool
*/
public function matchesAnything()
{
return $this->trigger->trigger_value === "";
}
/**
* @return bool
*/
@ -61,15 +71,4 @@ class DescriptionStarts implements TriggerInterface
}
/**
* 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

@ -64,8 +64,9 @@ class FromAccountContains implements TriggerInterface
}
/**
* Checks whether this trigger will match all transactions
* This happens when the trigger_value is empty
* @{inheritdoc}
*
* @see TriggerInterface::matchesAnything
*
* @return bool
*/

View File

@ -75,8 +75,9 @@ class FromAccountEnds implements TriggerInterface
/**
* Checks whether this trigger will match all transactions
* This happens when the trigger_value is empty
* @{inheritdoc}
*
* @see TriggerInterface::matchesAnything
*
* @return bool
*/

View File

@ -60,7 +60,9 @@ class FromAccountIs implements TriggerInterface
}
/**
* Checks whether this trigger will match all transactions
* @{inheritdoc}
*
* @see TriggerInterface::matchesAnything
*
* @return bool
*/

View File

@ -63,8 +63,9 @@ class FromAccountStarts implements TriggerInterface
/**
* Checks whether this trigger will match all transactions
* This happens when the trigger_value is empty
* @{inheritdoc}
*
* @see TriggerInterface::matchesAnything
*
* @return bool
*/

View File

@ -65,8 +65,9 @@ class ToAccountContains implements TriggerInterface
/**
* Checks whether this trigger will match all transactions
* This happens when the trigger_value is empty
* @{inheritdoc}
*
* @see TriggerInterface::matchesAnything
*
* @return bool
*/

View File

@ -75,8 +75,9 @@ class ToAccountEnds implements TriggerInterface
/**
* Checks whether this trigger will match all transactions
* This happens when the trigger_value is empty
* @{inheritdoc}
*
* @see TriggerInterface::matchesAnything
*
* @return bool
*/

View File

@ -60,7 +60,9 @@ class ToAccountIs implements TriggerInterface
}
/**
* Checks whether this trigger will match all transactions
* @{inheritdoc}
*
* @see TriggerInterface::matchesAnything
*
* @return bool
*/

View File

@ -63,8 +63,9 @@ class ToAccountStarts implements TriggerInterface
/**
* Checks whether this trigger will match all transactions
* This happens when the trigger_value is empty
* @{inheritdoc}
*
* @see TriggerInterface::matchesAnything
*
* @return bool
*/

View File

@ -59,7 +59,9 @@ class TransactionType implements TriggerInterface
}
/**
* Checks whether this trigger will match all transactions
* @{inheritdoc}
*
* @see TriggerInterface::matchesAnything
*
* @return bool
*/

View File

@ -38,6 +38,7 @@ class TriggerFactory
abort(500, 'No such trigger exists ("' . $triggerType . '").');
}
/** @var TriggerInterface $class */
$class = $triggerTypes[$triggerType];
if (!class_exists($class)) {
abort(500, 'Could not instantiate class for rule trigger type "' . $triggerType . '" (' . $class . ').');

View File

@ -29,8 +29,16 @@ interface TriggerInterface
public function __construct(RuleTrigger $trigger, TransactionJournal $journal);
/**
* Checks whether this trigger will match all transactions
* For example: amount > 0 or description starts with ''
* 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.
*
* @return bool
*/

View File

@ -54,7 +54,9 @@ class UserAction implements TriggerInterface
}
/**
* Checks whether this trigger will match all transactions
* @{inheritdoc}
*
* @see TriggerInterface::matchesAnything
*
* @return bool
*/