getResponses(); $interactions = $item->getInteractions(); $usedResponses = []; foreach ($interactions as $interaction) { $usedResponses[] = $interaction->attr('responseIdentifier'); } foreach ($responses as $response) { $responseIdentifier = $response->attr('identifier'); if (!in_array($responseIdentifier, $usedResponses)) { $changed = true; $item->removeResponse($response); } } $xml = simplexml_load_file($itemFile); $rpTemplate = (string) $xml->responseProcessing['template']; //detect wrong usage for standard standard response declaration $rp = $item->getResponseProcessing(); if ($rp instanceof \oat\taoQtiItem\model\qti\response\TemplatesDriven && $rpTemplate) { if (count($interactions) > 1) { $changed = true; } else { $interaction = reset($interactions); if ($interaction && $interaction->attr('responseIdentifier') != 'RESPONSE') { $changed = true; } } } return $changed; } }