Catch empty (null) descriptions. Which never happens.

Signed-off-by: James Cole <thegrumpydictator@gmail.com>
This commit is contained in:
James Cole 2016-08-26 07:37:27 +02:00
parent 0fe70dae17
commit 43a7544dd7
No known key found for this signature in database
GPG Key ID: C16961E655E74B5E
4 changed files with 4 additions and 4 deletions

View File

@ -55,7 +55,7 @@ final class DescriptionContains extends AbstractTrigger implements TriggerInterf
public function triggered(TransactionJournal $journal): bool
{
$search = strtolower($this->triggerValue);
$source = strtolower($journal->description);
$source = strtolower($journal->description ?? '');
$strpos = strpos($source, $search);
if (!($strpos === false)) {

View File

@ -53,7 +53,7 @@ final class DescriptionEnds extends AbstractTrigger implements TriggerInterface
*/
public function triggered(TransactionJournal $journal): bool
{
$description = strtolower($journal->description);
$description = strtolower($journal->description ?? '');
$descriptionLength = strlen($description);
$search = strtolower($this->triggerValue);
$searchLength = strlen($search);

View File

@ -53,7 +53,7 @@ final class DescriptionIs extends AbstractTrigger implements TriggerInterface
*/
public function triggered(TransactionJournal $journal): bool
{
$description = strtolower($journal->description);
$description = strtolower($journal->description ?? '');
$search = strtolower($this->triggerValue);
if ($description == $search) {

View File

@ -53,7 +53,7 @@ final class DescriptionStarts extends AbstractTrigger implements TriggerInterfac
*/
public function triggered(TransactionJournal $journal): bool
{
$description = strtolower($journal->description);
$description = strtolower($journal->description ?? '');
$search = strtolower($this->triggerValue);
$part = substr($description, 0, strlen($search));