models/classes/runner/OfflineQtiRunnerService.php
private function getItemData(RunnerServiceContext $context, $itemRef)
    {
        $this->getRunnerService()->assertQtiRunnerServiceContext($context);

        $itemData = $this->getRunnerService()->getItemData($context, $itemRef);
        $itemDataVariable = $this->getRunnerService()->getItemVariableElementsData($context, $itemRef);
        $responses = $itemData['data']['responses'];

        foreach (array_keys($responses) as $responseId) {
            if (array_key_exists($responseId, $itemDataVariable)) {
                $itemData['data']['responses'][$responseId] = array_merge(...[
                    $responses[$responseId],
                    $itemDataVariable[$responseId],
                ]);
            }
        }

        return $itemData;
    }
private function getItemData(RunnerServiceContext $context, $itemRef)
    {
        $this->getRunnerService()->assertQtiRunnerServiceContext($context);

        $itemData = $this->getRunnerService()->getItemData($context, $itemRef);
        $itemDataVariable = $this->getRunnerService()->getItemVariableElementsData($context, $itemRef);
        $responses = $itemData['data']['responses'];

        foreach (array_keys($responses) as $responseId) {
            if (array_key_exists($responseId, $itemDataVariable)) {
                $itemData['data']['responses'][$responseId] = array_merge(...[
                    $responses[$responseId],
                    $itemDataVariable[$responseId],
                ]);
            }
        }

        return $itemData;
    }
Returns the itemData, extending with the variable elements

@param RunnerServiceContext $context
@param string $itemRef
@return array
@throws \common_exception_InvalidArgumentType
@throws \common_Exception