models/classes/runner/QtiRunnerService.php
public function getItemState(RunnerServiceContext $context, $itemRef)
    {
        if ($context instanceof QtiRunnerServiceContext) {
            $serviceService = $this->getServiceManager()->get(StorageManager::SERVICE_ID);
            $userUri = \common_session_SessionManager::getSession()->getUserUri();
            $stateId = $this->getStateId($context, $itemRef);
            $state = is_null($userUri) ? null : $serviceService->get($userUri, $stateId);

            if ($state) {
                $state = json_decode($state, true);
                if (is_null($state)) {
                    throw new \common_exception_InconsistentData('Unable to decode the state for the item '.$itemRef);
                }
            }

            return $state;
        } else {
            throw new \common_exception_InvalidArgumentType(
                'QtiRunnerService',
                'getItemState',
                0,
                'oat\taoQtiTest\models\runner\QtiRunnerServiceContext',
                $context
            );
        }
    }
public function getItemState(RunnerServiceContext $context, $itemRef)
    {
        if ($context instanceof QtiRunnerServiceContext) {
            $serviceService = $this->getServiceManager()->get(StorageManager::SERVICE_ID);
            $userUri = \common_session_SessionManager::getSession()->getUserUri();
            $stateId = $this->getStateId($context, $itemRef);
            $state = is_null($userUri) ? null : $serviceService->get($userUri, $stateId);

            if ($state) {
                $state = json_decode($state, true);
                if (is_null($state)) {
                    throw new \common_exception_InconsistentData('Unable to decode the state for the item '.$itemRef);
                }
            }

            return $state;
        } else {
            throw new \common_exception_InvalidArgumentType(
                'QtiRunnerService',
                'getItemState',
                0,
                'oat\taoQtiTest\models\runner\QtiRunnerServiceContext',
                $context
            );
        }
    }
Gets the state of a particular item
@param RunnerServiceContext $context
@param string $itemRef
@return array|null
@throws \common_Exception