public static function createFromDataModel(VariableDeclaration $variableDeclaration)
    {
        $identifier = $variableDeclaration->getIdentifier();
        $baseType = $variableDeclaration->getBaseType();
        $cardinality = $variableDeclaration->getCardinality();

        $variable = new static($identifier, $cardinality, $baseType);

        // Default value?
        $dataModelDefaultValue = $variableDeclaration->getDefaultValue();

        if (!empty($dataModelDefaultValue)) {
            $dataModelValues = $dataModelDefaultValue->getValues();
            $defaultValue = static::dataModelValuesToRuntime($dataModelValues, $baseType, $cardinality);
            $variable->setDefaultValue($defaultValue);
        }

        return $variable;
    }
public static function createFromDataModel(VariableDeclaration $variableDeclaration)
    {
        $identifier = $variableDeclaration->getIdentifier();
        $baseType = $variableDeclaration->getBaseType();
        $cardinality = $variableDeclaration->getCardinality();

        $variable = new static($identifier, $cardinality, $baseType);

        // Default value?
        $dataModelDefaultValue = $variableDeclaration->getDefaultValue();

        if (!empty($dataModelDefaultValue)) {
            $dataModelValues = $dataModelDefaultValue->getValues();
            $defaultValue = static::dataModelValuesToRuntime($dataModelValues, $baseType, $cardinality);
            $variable->setDefaultValue($defaultValue);
        }

        return $variable;
    }
public static function createFromDataModel ( VariableDeclaration $ variableDeclaration ) { $ identifier = $ variableDeclaration -> getIdentifier ( ) ; $ baseType = $ variableDeclaration -> getBaseType ( ) ; $ cardinality = $ variableDeclaration -> getCardinality ( ) ; $ variable = new static ( $ identifier , $ cardinality , $ baseType ) ; // Default value? $ dataModelDefaultValue = $ variableDeclaration -> getDefaultValue ( ) ; if ( ! empty ( $ dataModelDefaultValue ) ) { $ dataModelValues = $ dataModelDefaultValue -> getValues ( ) ; $ defaultValue = static :: dataModelValuesToRuntime ( $ dataModelValues , $ baseType , $ cardinality ) ; $ variable -> setDefaultValue ( $ defaultValue ) ; } return $ variable ; }
Create a runtime Variable object from its Data Model representation.

@param \qtism\data\state\VariableDeclaration $variableDeclaration A VariableDeclaration object from the QTI Data Model.
@return \qtism\runtime\common\Variable A Variable object.
@throws \UnexpectedValueException If $variableDeclaration is not consistent.
Create a runtime Variable object from its Data Model representation .