/**
  * Marshall a testVariable QTI element in its TestVariable object equivalent.
  *
  * @param \DOMElement A DOMElement object.
  * @return \qtism\data\QtiComponent The corresponding TestVariable object.
  */
 protected function unmarshall(DOMElement $element)
 {
     $baseComponent = parent::unmarshall($element);
     if (($variableIdentifier = static::getDOMElementAttributeAs($element, 'variableIdentifier')) !== null) {
         $object = new TestVariables($variableIdentifier);
         $object->setSectionIdentifier($baseComponent->getSectionIdentifier());
         $object->setIncludeCategories($baseComponent->getIncludeCategories());
         $object->setExcludeCategories($baseComponent->getExcludeCategories());
         if (($baseType = static::getDOMElementAttributeAs($element, 'baseType')) !== null) {
             $object->setBaseType(BaseType::getConstantByName($baseType));
         }
         if (($weightIdentifier = static::getDOMElementAttributeAs($element, 'weightIdentifier')) !== null) {
             $object->setWeightIdentifier($weightIdentifier);
         }
         return $object;
     } else {
         $msg = "The mandatory attribute 'variableIdentifier' is missing from element '" . $element->localName . "'.";
         throw new UnmarshallingException($msg, $element);
     }
 }