public static function createFromDataModel(VariableDeclaration $variableDeclaration)
    {
        $variable = parent::createFromDataModel($variableDeclaration);

        if ($variableDeclaration instanceof TemplateDeclaration) {

            $variable->setParamVariable($variableDeclaration->isParamVariable());
            $variable->setMathVariable($variableDeclaration->isMathVariable());

            return $variable;
        } else {
            $msg = "TemplateVariable::createFromDataModel only accept 'qtism\\data\\state\\TemplateVariable' objects, '" . get_class($variableDeclaration) . "' given.";
            throw new InvalidArgumentException($msg);
        }
    }
public static function createFromDataModel(VariableDeclaration $variableDeclaration)
    {
        $variable = parent::createFromDataModel($variableDeclaration);

        if ($variableDeclaration instanceof TemplateDeclaration) {

            $variable->setParamVariable($variableDeclaration->isParamVariable());
            $variable->setMathVariable($variableDeclaration->isMathVariable());

            return $variable;
        } else {
            $msg = "TemplateVariable::createFromDataModel only accept 'qtism\\data\\state\\TemplateVariable' objects, '" . get_class($variableDeclaration) . "' given.";
            throw new InvalidArgumentException($msg);
        }
    }
public static function createFromDataModel ( VariableDeclaration $ variableDeclaration ) { $ variable = parent :: createFromDataModel ( $ variableDeclaration ) ; if ( $ variableDeclaration instanceof TemplateDeclaration ) { $ variable -> setParamVariable ( $ variableDeclaration -> isParamVariable ( ) ) ; $ variable -> setMathVariable ( $ variableDeclaration -> isMathVariable ( ) ) ; return $ variable ; } else { $ msg = "TemplateVariable::createFromDataModel only accept 'qtism\\data\\state\\TemplateVariable' objects, '" . get_class ( $ variableDeclaration ) . "' given." ; throw new InvalidArgumentException ( $ msg ) ; } }
Create a TemplateVariable object from its data model representation.

@param \qtism\data\state\VariableDeclaration $variableDeclaration
@throws \InvalidArgumentException
@return \qtism\runtime\common\TemplateVariable
Create a TemplateVariable object from its data model representation .