protected function convertStimulusForPrompt($stimulusString) { $stimulusComponents = QtiMarshallerUtil::unmarshallElement($stimulusString); $prompt = new Prompt(); $prompt->setContent(ContentCollectionBuilder::buildFlowStaticCollectionContent($stimulusComponents)); return $prompt; }
private function buildOptionCollection(choicematrix $question, $stemCount) { $optionIndexIdentifierMap = []; $optionCollection = new SimpleAssociableChoiceCollection(); foreach ($question->get_options() as $key => $optionValue) { // Learnosity's `choicematrix` always have its options to have any number of associable choice, thus setting to stems count // Same as above, won't validate upon empty response, thus setting match min to 1 $optionChoice = new SimpleAssociableChoice('OPTION_' . $key, $stemCount); $optionChoice->setMatchMin(1); $optionChoice->setContent(ContentCollectionBuilder::buildFlowStaticCollectionContent(QtiMarshallerUtil::unmarshallElement($optionValue))); $optionCollection->attach($optionChoice); $optionIndexIdentifierMap[$key] = $optionChoice->getIdentifier(); } return [$optionCollection, $optionIndexIdentifierMap]; }