protected function convertCatVariables(array $variables)
    {
        /** @var QtiRunnerService $runnerService */
        $runnerService = $this->getServiceLocator()->get(QtiRunnerService::SERVICE_ID);
        $convertedVariables = [];

        foreach ($variables as $variable) {

            switch ($variable->getVariableType()) {
                case ResultVariable::TRACE_VARIABLE:
                    $getVariableMethod = 'getTraceVariable';
                    break;
                case ResultVariable::RESPONSE_VARIABLE:
                    $getVariableMethod = 'getResponseVariable';
                    break;
                case ResultVariable::OUTCOME_VARIABLE:
                    $getVariableMethod = 'getOutcomeVariable';
                    break;
                case ResultVariable::TEMPLATE_VARIABLE:
                default:
                    $getVariableMethod = null;
                    break;
            }

            if (is_null($getVariableMethod)) {
                \common_Logger::w('Variable of type ' . $variable->getVariableType(). ' is not implemented in ' . __METHOD__);
                throw new \common_exception_NotImplemented();
            }

            $convertedVariables[] = call_user_func_array(
                array($runnerService, $getVariableMethod), array($variable->getId(), $variable->getValue())
            );
        }

        return $convertedVariables;
    }
protected function convertCatVariables(array $variables)
    {
        
        $runnerService = $this->getServiceLocator()->get(QtiRunnerService::SERVICE_ID);
        $convertedVariables = [];

        foreach ($variables as $variable) {

            switch ($variable->getVariableType()) {
                case ResultVariable::TRACE_VARIABLE:
                    $getVariableMethod = 'getTraceVariable';
                    break;
                case ResultVariable::RESPONSE_VARIABLE:
                    $getVariableMethod = 'getResponseVariable';
                    break;
                case ResultVariable::OUTCOME_VARIABLE:
                    $getVariableMethod = 'getOutcomeVariable';
                    break;
                case ResultVariable::TEMPLATE_VARIABLE:
                default:
                    $getVariableMethod = null;
                    break;
            }

            if (is_null($getVariableMethod)) {
                \common_Logger::w('Variable of type ' . $variable->getVariableType(). ' is not implemented in ' . __METHOD__);
                throw new \common_exception_NotImplemented();
            }

            $convertedVariables[] = call_user_func_array(
                array($runnerService, $getVariableMethod), array($variable->getId(), $variable->getValue())
            );
        }

        return $convertedVariables;
    }
protected function convertCatVariables ( array $ variables ) { /** @var QtiRunnerService $runnerService */ $ runnerService = $ this -> getServiceLocator ( ) -> get ( QtiRunnerService :: SERVICE_ID ) ; $ convertedVariables = [ ] ; foreach ( $ variables as $ variable ) { switch ( $ variable -> getVariableType ( ) ) { case ResultVariable :: TRACE_VARIABLE : $ getVariableMethod = 'getTraceVariable' ; break ; case ResultVariable :: RESPONSE_VARIABLE : $ getVariableMethod = 'getResponseVariable' ; break ; case ResultVariable :: OUTCOME_VARIABLE : $ getVariableMethod = 'getOutcomeVariable' ; break ; case ResultVariable :: TEMPLATE_VARIABLE : default : $ getVariableMethod = null ; break ; } if ( is_null ( $ getVariableMethod ) ) { \ common_Logger :: w ( 'Variable of type ' . $ variable -> getVariableType ( ) . ' is not implemented in ' . __METHOD__ ) ; throw new \ common_exception_NotImplemented ( ) ; } $ convertedVariables [ ] = call_user_func_array ( array ( $ runnerService , $ getVariableMethod ) , array ( $ variable -> getId ( ) , $ variable -> getValue ( ) ) ) ; } return $ convertedVariables ; }
Convert CAT variables to taoResultServer variables

Following the variable type, use the Runner service to get the appropriate variable
The method manage the trace, response and outcome variable

@param array $variables
@return array
@throws \common_exception_NotImplemented If variable type is not managed
Convert CAT variables to taoResultServer variables