code: public function getOutcomeVariable($variableIdentifier, $variableValue)
      {
          if (!is_string($variableValue) && !is_numeric($variableValue)) {
              $variableValue = json_encode($variableValue);
          }
          $metaVariable = new \taoResultServer_models_classes_OutcomeVariable();
          $metaVariable->setIdentifier($variableIdentifier);
          $metaVariable->setBaseType('string');
          $metaVariable->setCardinality(Cardinality::getNameByConstant(Cardinality::SINGLE));
          $metaVariable->setValue($variableValue);
  
          return $metaVariable;
      }
docs: Create an outcome variable from variable identifier and value
  
  @param $variableIdentifier
  @param $variableValue
  @return \taoResultServer_models_classes_OutcomeVariable
  @throws \common_exception_InvalidArgumentType