/** * Unmarshall a DOMElement object corresponding to a printedVariable element. * * @param DOMElement $element A DOMElement object. * @return QtiComponent A PrintedVariable object. * @throws UnmarshallingException */ protected function unmarshall(DOMElement $element) { if (($identifier = self::getDOMElementAttributeAs($element, 'identifier')) !== null) { $component = new PrintedVariable($identifier); if (($format = self::getDOMElementAttributeAs($element, 'format')) !== null) { $component->setFormat($format); } if (($powerForm = self::getDOMElementAttributeAs($element, 'powerForm', 'boolean')) !== null) { $component->setPowerForm($powerForm); } if (($base = self::getDOMElementAttributeAs($element, 'base')) !== null) { $component->setBase(Format::isInteger($base) === true ? intval($base) : $base); } if (($index = self::getDOMElementAttributeAs($element, 'index')) !== null) { $component->setIndex(Format::isInteger($index) === true ? intval($index) : $base); } if (($delimiter = self::getDOMElementAttributeAs($element, 'delimiter')) !== null) { $component->setDelimiter($delimiter); } if (($field = self::getDOMElementAttributeAs($element, 'field')) !== null) { $component->setField($field); } if ($mappingIndicator = self::getDOMElementAttributeAs($element, 'mappingIndicator')) { $component->setMappingIndicator($mappingIndicator); } if (($xmlBase = self::getXmlBase($element)) !== false) { $component->setXmlBase($xmlBase); } self::fillBodyElement($component, $element); return $component; } else { $msg = "The mandatory 'identifier' attribute is missing from the 'printedVariable' element."; throw new UnmarshallingException($msg, $element); } }