public function setCorrectResponse(QtiDatatype $correctResponse = null)
    {
        if ($correctResponse === null) {
            $this->correctResponse = null;
        } elseif (Utils::isBaseTypeCompliant($this->getBaseType(), $correctResponse) === true && Utils::isCardinalityCompliant($this->getCardinality(), $correctResponse) === true) {
            $this->correctResponse = $correctResponse;
        } else {
            $msg = "The given correct response is not compliant with the associated response variable.";
            throw new InvalidArgumentException($msg);
        }
    }
public function setCorrectResponse(QtiDatatype $correctResponse = null)
    {
        if ($correctResponse === null) {
            $this->correctResponse = null;
        } elseif (Utils::isBaseTypeCompliant($this->getBaseType(), $correctResponse) === true && Utils::isCardinalityCompliant($this->getCardinality(), $correctResponse) === true) {
            $this->correctResponse = $correctResponse;
        } else {
            $msg = "The given correct response is not compliant with the associated response variable.";
            throw new InvalidArgumentException($msg);
        }
    }
public function setCorrectResponse ( QtiDatatype $ correctResponse = null ) { if ( $ correctResponse === null ) { $ this -> correctResponse = null ; } elseif ( Utils :: isBaseTypeCompliant ( $ this -> getBaseType ( ) , $ correctResponse ) === true && Utils :: isCardinalityCompliant ( $ this -> getCardinality ( ) , $ correctResponse ) === true ) { $ this -> correctResponse = $ correctResponse ; } else { $ msg = "The given correct response is not compliant with the associated response variable." ; throw new InvalidArgumentException ( $ msg ) ; } }
Set the correct response.

@param \qtism\common\datatypes\QtiDatatype|null $correctResponse A QtiDatatype object or null.
@throws \InvalidArgumentException If $correctResponse does not match baseType and/or cardinality of the variable.
Set the correct response .