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

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

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

        if ($operands->exclusivelyString() === false) {
            $msg = "The StringMatch operator only accepts operands with a string baseType.";
            throw new OperatorProcessingException($msg, $this, OperatorProcessingException::WRONG_BASETYPE);
        }

        $expression = $this->getExpression();

        // choose the correct comparison function according comparison rules
        // of the operator.
        // Please note that strcmp and strcasecmp are binary-safe *\0/* Hourray! *\0/*
        $func = ($expression->isCaseSensitive() === true) ? 'strcmp' : 'strcasecmp';

        return new QtiBoolean($func($operands[0]->getValue(), $operands[1]->getValue()) === 0);
    }
public function process()
    {
        $operands = $this->getOperands();

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

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

        if ($operands->exclusivelyString() === false) {
            $msg = "The StringMatch operator only accepts operands with a string baseType.";
            throw new OperatorProcessingException($msg, $this, OperatorProcessingException::WRONG_BASETYPE);
        }

        $expression = $this->getExpression();

        // choose the correct comparison function according comparison rules
        // of the operator.
        // Please note that strcmp and strcasecmp are binary-safe *\0/* Hourray! *\0/*
        $func = ($expression->isCaseSensitive() === true) ? 'strcmp' : 'strcasecmp';

        return new QtiBoolean($func($operands[0]->getValue(), $operands[1]->getValue()) === 0);
    }
public function process ( ) { $ operands = $ this -> getOperands ( ) ; if ( $ operands -> containsNull ( ) === true ) { return null ; } if ( $ operands -> exclusivelySingle ( ) === false ) { $ msg = "The StringMatch operator only accepts operands with a single cardinality." ; throw new OperatorProcessingException ( $ msg , $ this , OperatorProcessingException :: WRONG_CARDINALITY ) ; } if ( $ operands -> exclusivelyString ( ) === false ) { $ msg = "The StringMatch operator only accepts operands with a string baseType." ; throw new OperatorProcessingException ( $ msg , $ this , OperatorProcessingException :: WRONG_BASETYPE ) ; } $ expression = $ this -> getExpression ( ) ; // choose the correct comparison function according comparison rules // of the operator. // Please note that strcmp and strcasecmp are binary-safe *\0/* Hourray! *\0/* $ func = ( $ expression -> isCaseSensitive ( ) === true ) ? 'strcmp' : 'strcasecmp' ; return new QtiBoolean ( $ func ( $ operands [ 0 ] -> getValue ( ) , $ operands [ 1 ] -> getValue ( ) ) === 0 ) ; }
Process the StringMatch operator.

@return boolean Whether the two string match according to the comparison rules of the operator's attributes or NULL if either of the sub-expressions is NULL.
@throws \qtism\runtime\expressions\operators\OperatorProcessingException
Process the StringMatch operator .