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

        if (($c = count($operands)) < 2) {
            $msg = "The 'qtism.runtime.expressions.operators.custom.Explode' custom operator takes 2 sub-expressions as parameters, ${c} given.";
            throw new OperatorProcessingException($msg, $this, OperatorProcessingException::NOT_ENOUGH_OPERANDS);
        } elseif ($operands->containsNull() === true) {
            return null;
        } elseif ($operands->exclusivelySingle() === false) {
            $msg = "The 'qtism.runtime.expressions.operators.custom.Explode' custom operator only accepts operands with single cardinality.";
            throw new OperatorProcessingException($msg, $this, OperatorProcessingException::WRONG_CARDINALITY);
        } elseif ($operands->exclusivelyString() === false) {
            $msg = "The 'qtism.runtime.expressions.operators.custom.Explode' custom operator only accepts operands with a string baseType.";
            throw new OperatorProcessingException($msg, $this, OperatorProcessingException::WRONG_BASETYPE);
        }

        $delimiter = $operands[0]->getValue();
        $string = $operands[1]->getValue();

        // Note: explode() is binary-safe \0/!
        $strings = explode($delimiter, $string);

        $ordered = new OrderedContainer(BaseType::STRING);
        foreach ($strings as $str) {
            $ordered[] = new QtiString($str);
        }

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

        if (($c = count($operands)) < 2) {
            $msg = "The 'qtism.runtime.expressions.operators.custom.Explode' custom operator takes 2 sub-expressions as parameters, ${c} given.";
            throw new OperatorProcessingException($msg, $this, OperatorProcessingException::NOT_ENOUGH_OPERANDS);
        } elseif ($operands->containsNull() === true) {
            return null;
        } elseif ($operands->exclusivelySingle() === false) {
            $msg = "The 'qtism.runtime.expressions.operators.custom.Explode' custom operator only accepts operands with single cardinality.";
            throw new OperatorProcessingException($msg, $this, OperatorProcessingException::WRONG_CARDINALITY);
        } elseif ($operands->exclusivelyString() === false) {
            $msg = "The 'qtism.runtime.expressions.operators.custom.Explode' custom operator only accepts operands with a string baseType.";
            throw new OperatorProcessingException($msg, $this, OperatorProcessingException::WRONG_BASETYPE);
        }

        $delimiter = $operands[0]->getValue();
        $string = $operands[1]->getValue();

        // Note: explode() is binary-safe \0/!
        $strings = explode($delimiter, $string);

        $ordered = new OrderedContainer(BaseType::STRING);
        foreach ($strings as $str) {
            $ordered[] = new QtiString($str);
        }

        return $ordered;
    }
public function process ( ) { $ operands = $ this -> getOperands ( ) ; if ( ( $ c = count ( $ operands ) ) < 2 ) { $ msg = "The 'qtism.runtime.expressions.operators.custom.Explode' custom operator takes 2 sub-expressions as parameters, ${c} given." ; throw new OperatorProcessingException ( $ msg , $ this , OperatorProcessingException :: NOT_ENOUGH_OPERANDS ) ; } elseif ( $ operands -> containsNull ( ) === true ) { return null ; } elseif ( $ operands -> exclusivelySingle ( ) === false ) { $ msg = "The 'qtism.runtime.expressions.operators.custom.Explode' custom operator only accepts operands with single cardinality." ; throw new OperatorProcessingException ( $ msg , $ this , OperatorProcessingException :: WRONG_CARDINALITY ) ; } elseif ( $ operands -> exclusivelyString ( ) === false ) { $ msg = "The 'qtism.runtime.expressions.operators.custom.Explode' custom operator only accepts operands with a string baseType." ; throw new OperatorProcessingException ( $ msg , $ this , OperatorProcessingException :: WRONG_BASETYPE ) ; } $ delimiter = $ operands [ 0 ] -> getValue ( ) ; $ string = $ operands [ 1 ] -> getValue ( ) ; // Note: explode() is binary-safe \0/! $ strings = explode ( $ delimiter , $ string ) ; $ ordered = new OrderedContainer ( BaseType :: STRING ) ; foreach ( $ strings as $ str ) { $ ordered [ ] = new QtiString ( $ str ) ; } return $ ordered ; }
Process the expression by implementing PHP core's explode function.

@return \qtism\runtime\common\OrderedContainer The split value of the second sub-expression given as a parameter.
@throws \qtism\runtime\expressions\operators\OperatorProcessingException If something goes wrong.
Process the expression by implementing PHP core s explode function .