protected static function getOutcomeMinimum($outcomeIdentifier, $weightIdentifier = '', $sectionIdentifier = '', IdentifierCollection $includeCategories = null, IdentifierCollection $excludeCategories = null) { $outcomeMinimum = new OutcomeMinimum($outcomeIdentifier); $outcomeMinimum->setSectionIdentifier($sectionIdentifier); if (empty($includeCategories) === false) { $outcomeMinimum->setIncludeCategories($includeCategories); } if (empty($excludeCategories) === false) { $outcomeMinimum->setExcludeCategories($excludeCategories); } if (empty($weightIdentifier) === false) { $outcomeMinimum->setWeightIdentifier($weightIdentifier); } return $outcomeMinimum; }
/** * Marshall a outcomeMinimum QTI element in its OutcomeMinimum object equivalent. * * @param \DOMElement A DOMElement object. * @return \qtism\data\QtiComponent The corresponding OutcomeMinimum object. */ protected function unmarshall(DOMElement $element) { $baseComponent = parent::unmarshall($element); if (($outcomeIdentifier = static::getDOMElementAttributeAs($element, 'outcomeIdentifier')) !== null) { $object = new OutcomeMinimum($outcomeIdentifier); $object->setSectionIdentifier($baseComponent->getSectionIdentifier()); $object->setIncludeCategories($baseComponent->getIncludeCategories()); $object->setExcludeCategories($baseComponent->getExcludeCategories()); if (($weightIdentifier = static::getDOMElementAttributeAs($element, 'weightIdentifier')) !== null) { $object->setWeightIdentifier($weightIdentifier); } return $object; } else { $msg = "The mandatory attribute 'outcomeIdentifier' is missing from element '" . $element->localName . "'."; throw new UnmarshallingException($msg, $element); } }