/**
  * Unmarshall a DOMElement object corresponding to a graphicGapMatchInteraction element.
  *
  * @param \DOMElement $element A DOMElement object.
  * @return \qtism\data\QtiComponent A GraphicGapMatchInteraction object.
  * @throws \qtism\data\storage\xml\marshalling\UnmarshallingException
  */
 protected function unmarshall(DOMElement $element)
 {
     if (($responseIdentifier = self::getDOMElementAttributeAs($element, 'responseIdentifier')) !== null) {
         $objectElts = self::getChildElementsByTagName($element, 'object');
         if (count($objectElts) > 0) {
             $object = $this->getMarshallerFactory()->createMarshaller($objectElts[0])->unmarshall($objectElts[0]);
             $associableHotspotElts = self::getChildElementsByTagName($element, 'associableHotspot');
             if (count($associableHotspotElts) > 0) {
                 $associableHotspots = new AssociableHotspotCollection();
                 foreach ($associableHotspotElts as $associableHotspotElt) {
                     $associableHotspots[] = $this->getMarshallerFactory()->createMarshaller($associableHotspotElt)->unmarshall($associableHotspotElt);
                 }
                 $gapImgElts = self::getChildElementsByTagName($element, 'gapImg');
                 if (count($gapImgElts) > 0) {
                     $gapImgs = new GapImgCollection();
                     foreach ($gapImgElts as $gapImgElt) {
                         $gapImgs[] = $this->getMarshallerFactory()->createMarshaller($gapImgElt)->unmarshall($gapImgElt);
                     }
                     $component = new GraphicGapMatchInteraction($responseIdentifier, $object, $gapImgs, $associableHotspots);
                     $promptElts = self::getChildElementsByTagName($element, 'prompt');
                     if (count($promptElts) > 0) {
                         $promptElt = $promptElts[0];
                         $prompt = $this->getMarshallerFactory()->createMarshaller($promptElt)->unmarshall($promptElt);
                         $component->setPrompt($prompt);
                     }
                     if (($xmlBase = self::getXmlBase($element)) !== false) {
                         $component->setXmlBase($xmlBase);
                     }
                     $this->fillBodyElement($component, $element);
                     return $component;
                 } else {
                     $msg = "A 'graphicGapMatchInteraction' element must contain at least one 'gapImg' element, none given.";
                     throw new UnmarshallingException($msg, $element);
                 }
             } else {
                 $msg = "A 'graphiGapMatchInteraction' element must contain at least one 'associableHotspot' element, none given.";
                 throw new UnmarshallingException($msg, $element);
             }
         } else {
             $msg = "A 'graphicGapMatchInteraction' element must contain exactly one 'object' element, none given.";
             throw new UnmarshallingException($msg, $element);
         }
     } else {
         $msg = "The mandatory 'responseIdentifier' attribute is missing from the 'graphicGapMatchInteraction' element.";
         throw new UnmarshallingException($msg, $element);
     }
 }