. */ declare(strict_types=1); namespace FireflyIII\TransactionRules\Actions; use FireflyIII\Models\RuleAction; use FireflyIII\Models\TransactionJournal; use Log; /** * Class PrependDescription. */ class PrependDescription implements ActionInterface { /** @var RuleAction The rule action */ private $action; /** * TriggerInterface constructor. * * @param RuleAction $action */ public function __construct(RuleAction $action) { $this->action = $action; } /** * Prepend description with X * * @param TransactionJournal $journal * * @return bool */ public function act(TransactionJournal $journal): bool { Log::debug(sprintf('RuleAction PrependDescription prepended "%s" to "%s".', $this->action->action_value, $journal->description)); $journal->description = $this->action->action_value . $journal->description; $journal->save(); return true; } }