models/classes/runner/QtiRunnerService.php
public function getTraceVariable($variableIdentifier, $variableValue)
    {
        if (!is_string($variableValue) && !is_numeric($variableValue)) {
            $variableValue = json_encode($variableValue);
        }
        $metaVariable = new \taoResultServer_models_classes_TraceVariable();
        $metaVariable->setIdentifier($variableIdentifier);
        $metaVariable->setBaseType('string');
        $metaVariable->setCardinality(Cardinality::getNameByConstant(Cardinality::SINGLE));
        $metaVariable->setTrace($variableValue);

        return $metaVariable;
    }
public function getTraceVariable($variableIdentifier, $variableValue)
    {
        if (!is_string($variableValue) && !is_numeric($variableValue)) {
            $variableValue = json_encode($variableValue);
        }
        $metaVariable = new \taoResultServer_models_classes_TraceVariable();
        $metaVariable->setIdentifier($variableIdentifier);
        $metaVariable->setBaseType('string');
        $metaVariable->setCardinality(Cardinality::getNameByConstant(Cardinality::SINGLE));
        $metaVariable->setTrace($variableValue);

        return $metaVariable;
    }
Create a trace variable from variable identifier and value

@param $variableIdentifier
@param $variableValue
@return \taoResultServer_models_classes_TraceVariable
@throws \common_exception_InvalidArgumentType