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

        if ($operands->containsNull() === true) {
            return null;
        } elseif ($operands->anythingButRecord() === false) {
            $msg = "The Product operator only accepts operands with a single, multiple or ordered cardinality.";
            throw new OperatorProcessingException($msg, $this, OperatorProcessingException::WRONG_CARDINALITY);
        } elseif ($operands->exclusivelyNumeric() === false) {
            $msg = "The Product operator only accepts operands with integer or float baseType.";
            throw new OperatorProcessingException($msg, $this, OperatorProcessingException::WRONG_BASETYPE);
        }

        $returnValue = 1;

        foreach ($this->getOperands() as $operand) {
            if ($operand instanceof QtiScalar) {
                $returnValue *= $operand->getValue();
            } else {
                foreach ($operand as $val) {
                    $returnValue *= $val->getValue();
                }
            }
        }

        return (is_int($returnValue)) ? new QtiInteger($returnValue) : new QtiFloat($returnValue);
    }
public function process()
    {
        $operands = $this->getOperands();

        if ($operands->containsNull() === true) {
            return null;
        } elseif ($operands->anythingButRecord() === false) {
            $msg = "The Product operator only accepts operands with a single, multiple or ordered cardinality.";
            throw new OperatorProcessingException($msg, $this, OperatorProcessingException::WRONG_CARDINALITY);
        } elseif ($operands->exclusivelyNumeric() === false) {
            $msg = "The Product operator only accepts operands with integer or float baseType.";
            throw new OperatorProcessingException($msg, $this, OperatorProcessingException::WRONG_BASETYPE);
        }

        $returnValue = 1;

        foreach ($this->getOperands() as $operand) {
            if ($operand instanceof QtiScalar) {
                $returnValue *= $operand->getValue();
            } else {
                foreach ($operand as $val) {
                    $returnValue *= $val->getValue();
                }
            }
        }

        return (is_int($returnValue)) ? new QtiInteger($returnValue) : new QtiFloat($returnValue);
    }
public function process ( ) { $ operands = $ this -> getOperands ( ) ; if ( $ operands -> containsNull ( ) === true ) { return null ; } elseif ( $ operands -> anythingButRecord ( ) === false ) { $ msg = "The Product operator only accepts operands with a single, multiple or ordered cardinality." ; throw new OperatorProcessingException ( $ msg , $ this , OperatorProcessingException :: WRONG_CARDINALITY ) ; } elseif ( $ operands -> exclusivelyNumeric ( ) === false ) { $ msg = "The Product operator only accepts operands with integer or float baseType." ; throw new OperatorProcessingException ( $ msg , $ this , OperatorProcessingException :: WRONG_BASETYPE ) ; } $ returnValue = 1 ; foreach ( $ this -> getOperands ( ) as $ operand ) { if ( $ operand instanceof QtiScalar ) { $ returnValue *= $ operand -> getValue ( ) ; } else { foreach ( $ operand as $ val ) { $ returnValue *= $ val -> getValue ( ) ; } } } return ( is_int ( $ returnValue ) ) ? new QtiInteger ( $ returnValue ) : new QtiFloat ( $ returnValue ) ; }
Process the Product operator.

@throws \qtism\runtime\expressions\operators\OperatorProcessingException If invalid operands are given.
Process the Product operator .