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

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

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

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

        $operand = $operands[0];

        if (is_nan($operand->getValue())) {
            return null;
        } elseif (is_infinite($operand->getValue())) {
            return new QtiFloat(INF);
        } else {
            return new QtiInteger(intval($operand->getValue()));
        }
    }
public function process()
    {
        $operands = $this->getOperands();

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

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

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

        $operand = $operands[0];

        if (is_nan($operand->getValue())) {
            return null;
        } elseif (is_infinite($operand->getValue())) {
            return new QtiFloat(INF);
        } else {
            return new QtiInteger(intval($operand->getValue()));
        }
    }
public function process ( ) { $ operands = $ this -> getOperands ( ) ; if ( $ operands -> containsNull ( ) === true ) { return null ; } if ( $ operands -> exclusivelySingle ( ) === false ) { $ msg = "The Truncate operator only accepts operands with a single cardinality." ; throw new OperatorProcessingException ( $ msg , $ this , OperatorProcessingException :: WRONG_CARDINALITY ) ; } if ( $ operands -> exclusivelyNumeric ( ) === false ) { $ msg = "The Truncate operator only accepts operands with an integer or float baseType." ; throw new OperatorProcessingException ( $ msg , $ this , OperatorProcessingException :: WRONG_BASETYPE ) ; } $ operand = $ operands [ 0 ] ; if ( is_nan ( $ operand -> getValue ( ) ) ) { return null ; } elseif ( is_infinite ( $ operand -> getValue ( ) ) ) { return new QtiFloat ( INF ) ; } else { return new QtiInteger ( intval ( $ operand -> getValue ( ) ) ) ; } }
Process the Truncate operator.

@return integer|null The truncated value or NULL if the sub-expression is NaN or if the sub-expression is NULL.
@throws \qtism\runtime\expressions\operators\OperatorProcessingException
Process the Truncate operator .