public function getQuestionType()
 {
     /** @var QtiGraphicGapMatchInteraction $interaction */
     $interaction = $this->interaction;
     /** @var Object $imageObject */
     $imageObject = $interaction->getObject();
     // Yes, width and height is necessary unfortunately
     if ($imageObject->getHeight() < 0 || $imageObject->getWidth() < 0) {
         throw new MappingException('Hotspot interaction image object need to specifiy both width and height for conversion');
     }
     $possibleResponseMapping = $this->buildPossibleResponseMapping($interaction);
     $associableHotspots = $this->buildTemplate($interaction, $imageObject);
     $image = new imageclozeassociation_image();
     $image->set_src($imageObject->getData());
     $responseContainers = [];
     $responsePosition = [];
     foreach ($associableHotspots as $associableHotspot) {
         $responsePosition[] = ['x' => $associableHotspot['x'], 'y' => $associableHotspot['y']];
         $responseContainer = new imageclozedropdown_response_containers_item();
         $responseContainer->set_height($associableHotspot['height'] . 'px');
         $responseContainer->set_width($associableHotspot['width'] . 'px');
         $responseContainers[] = $responseContainer;
     }
     $question = new imageclozeassociation($image, $responsePosition, 'imageclozeassociation', array_values($possibleResponseMapping));
     $question->set_response_containers($responseContainers);
     $question->set_stimulus($this->getPrompt());
     // Build dah` validation
     $hotspotIdentifiers = array_keys($associableHotspots);
     $validationBuilder = new GapMatchInteractionValidationBuilder('imageclozeassociation', $hotspotIdentifiers, $possibleResponseMapping, $this->responseDeclaration);
     $validation = $validationBuilder->buildValidation($this->responseProcessingTemplate);
     if ($validation) {
         $question->set_validation($validation);
     }
     $question->set_duplicate_responses($validationBuilder->isDuplicatedResponse());
     return $question;
 }
 private function buildMainImageObject(imageclozeassociation_image $image)
 {
     $imageSrc = $image->get_src();
     list($imageWidth, $imageHeight) = CurlUtil::getImageSize(CurlUtil::prepareUrlForCurl($imageSrc));
     $imageObject = new Object($imageSrc, MimeUtil::guessMimeType($imageSrc));
     $imageObject->setWidth($imageWidth);
     $imageObject->setHeight($imageHeight);
     // Map `alt` to object content
     if (!is_null($image->get_alt())) {
         $objectFlowCollection = new ObjectFlowCollection();
         $objectFlowCollection->attach(new TextRun($image->get_alt()));
         $imageObject->setContent($objectFlowCollection);
     }
     return $imageObject;
 }