public function process()
    {
        $operands = $this->getOperands();

        if ($operands->containsNull() === true) {
            return null;
        }

        if ($operands->exclusivelySingle() === false) {
            $msg = "The Round operator only accepts operands with a single cardinality.";
            throw new OperatorProcessingException($msg, $this, OperatorProcessingException::WRONG_CARDINALITY);
        }

        if ($operands->exclusivelyNumeric() === false) {
            $msg = "The Round operator only accepts operands with baseType integer or float.";
            throw new OperatorProcessingException($msg, $this, OperatorProcessingException::WRONG_BASETYPE);
        }

        $operand = $operands[0];
        $mode = ($operand->getValue() >= 0) ? PHP_ROUND_HALF_UP : PHP_ROUND_HALF_DOWN;

        return new QtiInteger(intval(round($operand->getValue(), 0, $mode)));
    }
public function process()
    {
        $operands = $this->getOperands();

        if ($operands->containsNull() === true) {
            return null;
        }

        if ($operands->exclusivelySingle() === false) {
            $msg = "The Round operator only accepts operands with a single cardinality.";
            throw new OperatorProcessingException($msg, $this, OperatorProcessingException::WRONG_CARDINALITY);
        }

        if ($operands->exclusivelyNumeric() === false) {
            $msg = "The Round operator only accepts operands with baseType integer or float.";
            throw new OperatorProcessingException($msg, $this, OperatorProcessingException::WRONG_BASETYPE);
        }

        $operand = $operands[0];
        $mode = ($operand->getValue() >= 0) ? PHP_ROUND_HALF_UP : PHP_ROUND_HALF_DOWN;

        return new QtiInteger(intval(round($operand->getValue(), 0, $mode)));
    }
public function process ( ) { $ operands = $ this -> getOperands ( ) ; if ( $ operands -> containsNull ( ) === true ) { return null ; } if ( $ operands -> exclusivelySingle ( ) === false ) { $ msg = "The Round operator only accepts operands with a single cardinality." ; throw new OperatorProcessingException ( $ msg , $ this , OperatorProcessingException :: WRONG_CARDINALITY ) ; } if ( $ operands -> exclusivelyNumeric ( ) === false ) { $ msg = "The Round operator only accepts operands with baseType integer or float." ; throw new OperatorProcessingException ( $ msg , $ this , OperatorProcessingException :: WRONG_BASETYPE ) ; } $ operand = $ operands [ 0 ] ; $ mode = ( $ operand -> getValue ( ) >= 0 ) ? PHP_ROUND_HALF_UP : PHP_ROUND_HALF_DOWN ; return new QtiInteger ( intval ( round ( $ operand -> getValue ( ) , 0 , $ mode ) ) ) ; }
Process the Round operator.

@return integer|null An integer value formed by rounding the value of the sub-expression or NULL if the sub-expression is NULL.
@throws \qtism\runtime\expressions\operators\OperatorProcessingException
Process the Round operator .