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

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

        if ($operands->sameBaseType() === false) {
            $msg = "The Delete operator only accepts operands with the same baseType.";
            throw new OperatorProcessingException($msg, $this, OperatorProcessingException::WRONG_BASETYPE);
        }

        $operand1 = $operands[0];
        if (RuntimeUtils::inferCardinality($operand1) !== Cardinality::SINGLE) {
            $msg = "The first operand of the Delete operator must have the single cardinality.";
            throw new OperatorProcessingException($msg, $this, OperatorProcessingException::WRONG_CARDINALITY);
        }

        $operand2 = $operands[1];
        $cardinality = RuntimeUtils::inferCardinality($operand2);
        if ($cardinality !== Cardinality::MULTIPLE && $cardinality !== Cardinality::ORDERED) {
            $msg = "The second operand of the Delete operator must have a cardinality or multiple or ordered.";
            throw new OperatorProcessingException($msg, $this, OperatorProcessingException::WRONG_CARDINALITY);
        }

        $returnedBaseType = RuntimeUtils::inferBaseType($operand1);
        $returnValue = ($cardinality === Cardinality::MULTIPLE) ? new MultipleContainer($returnedBaseType) : new OrderedContainer($returnedBaseType);

        foreach ($operand2 as $value) {
            if ($value === $operand1 || ($operand1 instanceof Comparable && $operand1->equals($value) === true)) {
                // This is the same value, it will not be included in the returned value.
                continue;
            } else {
                $returnValue[] = $value;
            }
        }

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

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

        if ($operands->sameBaseType() === false) {
            $msg = "The Delete operator only accepts operands with the same baseType.";
            throw new OperatorProcessingException($msg, $this, OperatorProcessingException::WRONG_BASETYPE);
        }

        $operand1 = $operands[0];
        if (RuntimeUtils::inferCardinality($operand1) !== Cardinality::SINGLE) {
            $msg = "The first operand of the Delete operator must have the single cardinality.";
            throw new OperatorProcessingException($msg, $this, OperatorProcessingException::WRONG_CARDINALITY);
        }

        $operand2 = $operands[1];
        $cardinality = RuntimeUtils::inferCardinality($operand2);
        if ($cardinality !== Cardinality::MULTIPLE && $cardinality !== Cardinality::ORDERED) {
            $msg = "The second operand of the Delete operator must have a cardinality or multiple or ordered.";
            throw new OperatorProcessingException($msg, $this, OperatorProcessingException::WRONG_CARDINALITY);
        }

        $returnedBaseType = RuntimeUtils::inferBaseType($operand1);
        $returnValue = ($cardinality === Cardinality::MULTIPLE) ? new MultipleContainer($returnedBaseType) : new OrderedContainer($returnedBaseType);

        foreach ($operand2 as $value) {
            if ($value === $operand1 || ($operand1 instanceof Comparable && $operand1->equals($value) === true)) {
                // This is the same value, it will not be included in the returned value.
                continue;
            } else {
                $returnValue[] = $value;
            }
        }

        return $returnValue;
    }
public function process ( ) { $ operands = $ this -> getOperands ( ) ; if ( $ operands -> containsNull ( ) === true ) { return null ; } if ( $ operands -> sameBaseType ( ) === false ) { $ msg = "The Delete operator only accepts operands with the same baseType." ; throw new OperatorProcessingException ( $ msg , $ this , OperatorProcessingException :: WRONG_BASETYPE ) ; } $ operand1 = $ operands [ 0 ] ; if ( RuntimeUtils :: inferCardinality ( $ operand1 ) !== Cardinality :: SINGLE ) { $ msg = "The first operand of the Delete operator must have the single cardinality." ; throw new OperatorProcessingException ( $ msg , $ this , OperatorProcessingException :: WRONG_CARDINALITY ) ; } $ operand2 = $ operands [ 1 ] ; $ cardinality = RuntimeUtils :: inferCardinality ( $ operand2 ) ; if ( $ cardinality !== Cardinality :: MULTIPLE && $ cardinality !== Cardinality :: ORDERED ) { $ msg = "The second operand of the Delete operator must have a cardinality or multiple or ordered." ; throw new OperatorProcessingException ( $ msg , $ this , OperatorProcessingException :: WRONG_CARDINALITY ) ; } $ returnedBaseType = RuntimeUtils :: inferBaseType ( $ operand1 ) ; $ returnValue = ( $ cardinality === Cardinality :: MULTIPLE ) ? new MultipleContainer ( $ returnedBaseType ) : new OrderedContainer ( $ returnedBaseType ) ; foreach ( $ operand2 as $ value ) { if ( $ value === $ operand1 || ( $ operand1 instanceof Comparable && $ operand1 -> equals ( $ value ) === true ) ) { // This is the same value, it will not be included in the returned value. continue ; } else { $ returnValue [ ] = $ value ; } } return $ returnValue ; }
Process the Delete operator.

@return \qtism\common\collections\Container A new container derived from the second sub-expression with all instances of the first sub-expression removed, or NULL if either sub-expression is considered to be NULL.
@throws \qtism\runtime\expressions\operators\OperatorProcessingException
Process the Delete operator .