based rules. * * 'weight-identifier' (string) : The identifier of the item reference weight to be used when generating based rules. * * 'category-exclusions' (array) : An array of PCREs describing what are the categories to be excluded from the rule generation process. * * 'flags' (integer) : A binary flags configuration of the rule generation process composed by values described by the TestCategoryRulesGenerator class constants. * * @param array $options (optional) An optional array of options. */ public function __construct(array $options = []) { parent::__construct($options); $generator = new TestCategoryRulesGenerator(); $generator->setScoreVariableIdentifier(empty($options['score-variable-identifier']) ? 'SCORE' : (string) $options['score-variable-identifier']); $generator->setWeightIdentifier(array_key_exists('weight-identifier', $options) ? (string) $options['weight-identifier'] : ''); $generator->setCategoryExclusions(empty($options['category-exclusions']) ? [] : $options['category-exclusions']); $this->setGenerator($generator); } /** * Set the generator. * * Set the TestCategoryRulesGenerator object to be used by the service. * * @param oat\taoQtiTest\models\TestCategoryRulesGenerator $generator A TestCategoryRulesGenerator object. */ protected function setGenerator(TestCategoryRulesGenerator $generator) { $this->generator = $generator; } /** * Get the generator. * * Get the TestCategoryRulesGenerator object to be used by the service. * * @return oat\taoQtiTest\models\TestCategoryRulesGenerator A TestCategoryRulesGenerator object. */ protected function getGenerator() { return $this->generator; } /** * Apply the category based rule generation process on a given Assessment Test. * * Calling this method will trigger the category based rule generation process on the given * AssessmentTest $test object, depending on the $options parameters provided to the constructor * of the service. * * @param qtism\data\AssessmentTest $test A QTI-SDK AssessmentTest object. */ public function apply(AssessmentTest $test) { $this->getGenerator()->apply($test, (int) $this->getOption('flags')); } }