rule = $rule; $this->journal = $journal; $this->triggerTypes = Domain::getRuleTriggers(); } public function handle() { // get all triggers: $triggered = $this->triggered(); if ($triggered) { } } /** * @return bool */ protected function triggered() { /** @var RuleTrigger $trigger */ foreach ($this->rule->ruleTriggers as $trigger) { $type = $trigger->trigger_type; $class = $this->triggerTypes[$type]; if (!class_exists($class)) { throw new Exception('Could not instantiate class for rule trigger type "' . $type . '".'); } } return true; } /** * @return Rule */ public function getRule() { return $this->rule; } /** * @param Rule $rule */ public function setRule($rule) { $this->rule = $rule; } /** * @return TransactionJournal */ public function getJournal() { return $this->journal; } /** * @param TransactionJournal $journal */ public function setJournal($journal) { $this->journal = $journal; } }