models/classes/runner/QtiRunnerService.php
public function switchClientStoreId(RunnerServiceContext $context, $receivedStoreId)
    {
        if ($context instanceof QtiRunnerServiceContext){
            /* @var TestSession $session */
            $session = $context->getTestSession();
            $sessionId = $session->getSessionId();

            $stateService = $this->getServiceManager()->get(ExtendedStateService::SERVICE_ID);
            $lastStoreId = $stateService->getStoreId($sessionId);

            if($lastStoreId == false || $lastStoreId != $receivedStoreId){
                $stateService->setStoreId($sessionId, $receivedStoreId);
            }

            return $lastStoreId;
        } else {
            throw new \common_exception_InvalidArgumentType(
                'QtiRunnerService',
                'switchClientStoreId',
                0,
                'oat\taoQtiTest\models\runner\QtiRunnerServiceContext',
                $context
            );
        }
    }
public function switchClientStoreId(RunnerServiceContext $context, $receivedStoreId)
    {
        if ($context instanceof QtiRunnerServiceContext){
            /* @var TestSession $session */
            $session = $context->getTestSession();
            $sessionId = $session->getSessionId();

            $stateService = $this->getServiceManager()->get(ExtendedStateService::SERVICE_ID);
            $lastStoreId = $stateService->getStoreId($sessionId);

            if($lastStoreId == false || $lastStoreId != $receivedStoreId){
                $stateService->setStoreId($sessionId, $receivedStoreId);
            }

            return $lastStoreId;
        } else {
            throw new \common_exception_InvalidArgumentType(
                'QtiRunnerService',
                'switchClientStoreId',
                0,
                'oat\taoQtiTest\models\runner\QtiRunnerServiceContext',
                $context
            );
        }
    }
Switch the received client store ids. Put the received id if different from the last stored.
This enables us to check wether the stores has been changed during a test session.
@param RunnerServiceContext $context
@param string $receivedStoreId The identifier of the client side store
@return string the identifier of the LAST saved client side store
@throws \common_exception_InvalidArgumentType