/** * Set the SetOutcomeValue object to be processed. * * @param Rule $rule A SetOutcomeValue object. * @throws InvalidArgumentException If $rule is not a SetOutcomeValue object. */ public function setRule(Rule $rule) { if ($rule instanceof SetOutcomeValue) { parent::setRule($rule); } else { $msg = "The SetOutcomeValueProcessor only accepts SetOutcomeValue objects to be processed."; throw new InvalidArgumentException($msg); } }
/** * Set the ExitTest object to be processed. * * @param Rule $rule An ExitTest object. * @throws InvalidArgumentException If $rule is not an ExitTest object. */ public function setRule(Rule $rule) { if ($rule instanceof ExitTest) { parent::setRule($rule); } else { $msg = "The ExitTestProcessor only accepts ExitTest objects to be processed."; throw new InvalidArgumentException($msg); } }
/** * Set the OutcomeCondition/ResponseCondition object to be processed. * * @param Rule $rule An OutcomeCondition/ResponseCondition object. * @throws InvalidArgumentException If $rule is not an OutcomeCondition nor a ResponseCondition object. */ public function setRule(Rule $rule) { $className = ucfirst($this->getQtiNature()) . 'Condition'; if (get_class($rule) === 'qtism\\data\\rules\\' . $className) { parent::setRule($rule); } else { $msg = "The {$className}Processor only accepts {$className} objects to be processed."; throw new InvalidArgumentException($msg); } }