Process the Member operator.

@return boolean Whether the first operand is contained by the second one as a boolean value, or NULL if any of the sub-expressions are NULL.
@throws \qtism\runtime\expressions\operators\OperatorProcessingException
14279
public function process()
    {
        $operands = $this->getOperands();

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

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

        $operand1 = $operands[0];
        $operand2 = $operands[1];

        // The first expression must have single cardinality.
        if (CommonUtils::inferCardinality($operand1) !== Cardinality::SINGLE) {
            $msg = "The first operand of the Member operator must have a single cardinality.";
            throw new OperatorProcessingException($msg, $this, OperatorProcessingException::WRONG_CARDINALITY);
        }

        // The second expression must have multiple or ordered cardinality.
        $cardinality = CommonUtils::inferCardinality($operand2);
        if ($cardinality === Cardinality::SINGLE) {
            $operand2 = new MultipleContainer($operand1->getBaseType(), array($operand2));
        } elseif ($cardinality !== Cardinality::MULTIPLE && $cardinality !== Cardinality::ORDERED) {
            $msg = "The second operand of the Member operator must have a single, multiple or ordered cardinality.";
            throw new OperatorProcessingException($msg, $this, OperatorProcessingException::WRONG_CARDINALITY);
        }

        return new QtiBoolean($operand2->contains($operand1));
    }
527475
public function process()
    {
        $operands = $this->getOperands();

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

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

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

        $operand1 = $operands[0];
        $operand2 = $operands[1];

        $subtract = $operand1->getValue() - $operand2->getValue();

        return (is_int($subtract) === true) ? new QtiInteger($subtract) : new QtiFloat($subtract);
    }
95681
protected function doProcessing()
    {
        $this->prepareProcessContext();


        // initialization process pipeline

        $initSteps = $this->initProcessSteps();

        if ( ! empty($initSteps)) {

            $this->context = app(Pipeline::class)
                 ->send($this->context)
                 ->through($initSteps)
                 ->then(function (ProcessContextInterface $context) {

                    return $context;
                 });

            $this->afterInitSteps();
        }


        // main pipeline (actual processing)

        $steps = $this->processSteps();

        if ($this->databaseTransaction) DB::beginTransaction();

        try {

            $this->context = app(Pipeline::class)
                 ->send($this->context)
                 ->through($steps)
                 ->then(function(ProcessContextInterface $context) {

                    if ($this->databaseTransaction) DB::commit();

                    return $context;
                 });

        } catch (Exception $e) {

            if ($this->databaseTransaction) DB::rollBack();

            $this->onExceptionInPipeline($e);

            throw $e;
        }

        $this->afterPipeline();


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

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

        if ($operands->exclusivelyMultipleOrOrdered() === false) {
            $msg = "The Contains Expression only accept operands with multiple or ordered cardinality.";
            throw new OperatorProcessingException($msg, $this, OperatorProcessingException::WRONG_CARDINALITY);
        }

        if ($operands->sameCardinality() === false) {
            $msg = "The Contains Expression only accept operands with the same cardinality.";
            throw new OperatorProcessingException($msg, $this, OperatorProcessingException::WRONG_CARDINALITY);
        }

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

        $operand1 = $operands[0];
        $operand2 = $operands[1];

        if ($operand1->getCardinality() === Cardinality::MULTIPLE) {
            foreach ($operand2 as $value) {
                if ($operand1->contains($value) === false || $operand1->occurences($value) !== $operand2->occurences($value)) {
                    return new QtiBoolean(false);
                }
            }

            return new QtiBoolean(true);
        } else {
            // $operand1->getCardinality() === Cardinality::ORDERED
            $op1Index = 0;
            $op2Index = 0;
            $lastFoundIndex = -1;
            $foundCount = 0;

            while ($op1Index < count($operand1)) {
                $op1Val = $operand1[$op1Index];
                $op2Val = $operand2[$op2Index];

                if ($op2Val === $op1Val || ($op2Val instanceof Comparable && $op2Val->equals($op1Val))) {
                    $op2Index++;

                    if ($lastFoundIndex >= 0 && ($op1Index - $lastFoundIndex) > 1) {
                        // Sequence not respected.
                        return new QtiBoolean(false);
                    } else {
                        $lastFoundIndex = $op1Index;
                        $foundCount++;
                    }
                }

                $op1Index++;
            }

            if ($foundCount > 0 && $foundCount === count($operand2)) {
                return new QtiBoolean(true);
            } else {
                return new QtiBoolean(false);
            }
        }
    }
840946
private function OperatorState()
	{
		$this->SkipWhitespace();
		$this->BeginToken();
		$c = $this->Peek( 0 );
		if ( $c == "\0" )
		{
			$this->ConsumeToken1( 0 );
		}
		else if ( $c == ';' || $c == ',' || $c == '=' || $c == '+' || $c == '-' || $c == '[' || $c == '|' )
		{
			$this->ConsumeChar( $this->Read() );
			if ( $c == '[' )
				array_push( $this->m_states, $this->m_state );
			$this->m_state = LexerState::DefaultState;
		}
		else if ( $c == '*' )
		{
			$this->Read();
			$this->EndToken();
			$this->ConsumeToken1( Token::ML );
			$this->m_state = LexerState::DefaultState;
		}
		else if ( $c == ':' && $this->Peek( 1 ) == '=' )
		{
			$this->ConsumeChar( $this->Read() );
			$this->BeginToken();
			$this->ConsumeChar( $this->Read() );
			$this->m_state = LexerState::DefaultState;
		}
		else if ( $c == '!' && $this->Peek( 1 ) == '=' )
		{
			$this->ConsumeChar( $this->Read() );
			$this->BeginToken();
			$this->ConsumeChar( $this->Read() );
			$this->m_state = LexerState::DefaultState;
		}
		else if ( $c == '>' )
		{
			$this->ConsumeChar( $this->Read() );
			if ( $this->Peek( 0 ) == '=' || $this->Peek( 0 ) == '>' )
			{
				$this->BeginToken();
				$this->ConsumeChar( $this->Read() );
			}
			$this->m_state = LexerState::DefaultState;

		}
		else if ( $c == '<' )
		{
			$this->ConsumeChar( $this->Read() );
			if ( $this->Peek( 0 ) == '=' || $this->Peek( 0 ) == '<' )
			{
				$this->BeginToken();
				$this->ConsumeChar( $this->Read() );
			}
			$this->m_state = LexerState::DefaultState;

		}
		else if ( $c == '/' )
		{
			if ( $this->Peek( 1 ) == '/' )
			{
				$this->Read();
				$this->Read();
				$this->EndToken();
				$this->ConsumeToken1( Token::DOUBLE_SLASH );
			}
			else
				$this->ConsumeChar( $this->Read() );
			$this->m_state = LexerState::DefaultState;
		}
		else if ( $c == ')' )
		{
			$this->ConsumeChar( $this->Read() );
			$this->SkipWhitespace();
			$this->BeginToken();
		}
		else if ( $c == '?' )
			$this->ConsumeChar( $this->Read() );
		else if ( $c == ']' )
		{
			$this->ConsumeChar( $this->Read() );
			$this->m_state = array_pop( $this->m_states );
		}
		else if ( $this->MatchIdentifer( "then" ) )
		{
			$this->EndToken();
			$this->ConsumeToken1( Token::THEN );
			$this->m_state = LexerState::DefaultState;
		}
		else if ( $this->MatchIdentifer( "else" ) )
		{
			$this->EndToken();
			$this->ConsumeToken1( Token::ELSE_TOKEN );
			$this->m_state = LexerState::DefaultState;
		}
		else if ( $this->MatchIdentifer( "and" ) )
		{
			$this->EndToken();
			$this->ConsumeToken1( Token::AND_TOKEN );
			$this->m_state = LexerState::DefaultState;
		}
		else if ( $this->MatchIdentifer( "div" ) )
		{
			$this->EndToken();
			$this->ConsumeToken1( Token::DIV );
			$this->m_state = LexerState::DefaultState;
		}
		else if ( $this->MatchIdentifer( "except" ) )
		{
			$this->EndToken();
			$this->ConsumeToken1( Token::EXCEPT );
			$this->m_state = LexerState::DefaultState;
		}
		else if ( $this->MatchIdentifer( "idiv" ) )
		{
			$this->EndToken();
			$this->ConsumeToken1( Token::IDIV );
			$this->m_state = LexerState::DefaultState;
		}
		else if ( $this->MatchIdentifer( "intersect" ) )
		{
			$this->EndToken();
			$this->ConsumeToken1( Token::INTERSECT );
			$this->m_state = LexerState::DefaultState;
		}
		else if ( $this->MatchIdentifer( "mod" ) )
		{
			$this->EndToken();
			$this->ConsumeToken1( Token::MOD );
			$this->m_state = LexerState::DefaultState;
		}
		else if ( $this->MatchIdentifer( "or" ) )
		{
			$this->EndToken();
			$this->ConsumeToken1( Token::OR_TOKEN );
			$this->m_state = LexerState::DefaultState;
		}
		else if ( $this->MatchIdentifer( "return" ) )
		{
			$this->EndToken();
			$this->ConsumeToken1( Token::RETURN_TOKEN );
			$this->m_state = LexerState::DefaultState;
		}
		else if ( $this->MatchIdentifer( "satisfies" ) )
		{
			$this->EndToken();
			$this->ConsumeToken1( Token::SATISFIES );
			$this->m_state = LexerState::DefaultState;
		}
		else if ( $this->MatchIdentifer( "to" ) )
		{
			$this->EndToken();
			$this->ConsumeToken1( Token::TO );
			$this->m_state = LexerState::DefaultState;
		}
		else if ( $this->MatchIdentifer( "union" ) )
		{
			$this->EndToken();
			$this->ConsumeToken1( Token::UNION );
			$this->m_state = LexerState::DefaultState;
		}
		else if ( $this->MatchIdentifer( array( "castable", "as" ) ) )
		{
			$this->EndToken();
			$this->ConsumeToken1( Token::CASTABLE_AS );
			$this->m_state = LexerState::SingleType;
		}
		else if ( $this->MatchIdentifer( array( "cast", "as" ) ) )
		{
			$this->EndToken();
			$this->ConsumeToken1( Token::CAST_AS );
			$this->m_state = LexerState::SingleType;
		}
		else if ( $this->MatchIdentifer( array( "instance", "of" ) ) )
		{
			$this->EndToken();
			$this->ConsumeToken1( Token::INSTANCE_OF );
			$this->m_state = LexerState::ItemType;
		}
		else if ( $this->MatchIdentifer( array( "treat", "as" ) ) )
		{
			$this->EndToken();
			$this->ConsumeToken1( Token::TREAT_AS );
			$this->m_state = LexerState::ItemType;
		}
		else if ( $this->MatchIdentifer( "in" ) )
		{
			$this->EndToken();
			$this->ConsumeToken1( Token::IN );
			$this->m_state = LexerState::DefaultState;
		}
		else if ( $this->MatchIdentifer( "is" ) )
		{
			$this->EndToken();
			$this->ConsumeToken1( Token::IS );
			$this->m_state = LexerState::DefaultState;
		}
		else if ( $c == '$' )
		{
			$this->ConsumeChar( $this->Read() );
			$this->m_state = LexerState::VarName;
		}
		else if ( $this->MatchIdentifer( "for" ) )
		{
			$this->EndToken();
			$this->ConsumeToken1( Token::FOR_TOKEN );
			$this->SkipWhitespace();
			$this->BeginToken();
			if ( $this->Peek( 0 ) == '$' )
				$this->ConsumeChar( $this->Read() );
			else
				throw XPath2Exception::withErrorCodeAndParam( "", Resources::ExpectedVariablePrefix, "for" );
			$this->m_state = LexerState::VarName;
		}
		else if ( $this->MatchIdentifer( "eq" ) )
		{
			$this->EndToken();
			$this->ConsumeToken1( Token::EQ );
			$this->m_state = LexerState::DefaultState;
		}
		else if ( $this->MatchIdentifer( "ge" ) )
		{
			$this->EndToken();
			$this->ConsumeToken1( Token::GE );
			$this->m_state = LexerState::DefaultState;
		}
		else if ( $this->MatchIdentifer( "gt" ) )
		{
			$this->EndToken();
			$this->ConsumeToken1( Token::GT );
			$this->m_state = LexerState::DefaultState;
		}
		else if ( $this->MatchIdentifer( "le" ) )
		{
			$this->EndToken();
			$this->ConsumeToken1( Token::LE );
			$this->m_state = LexerState::DefaultState;
		}
		else if ( $this->MatchIdentifer( "lt" ) )
		{
			$this->EndToken();
			$this->ConsumeToken1( Token::LT );
			$this->m_state = LexerState::DefaultState;
		}
		else if ( $this->MatchIdentifer( "ne" ) )
		{
			$this->EndToken();
			$this->ConsumeToken1( Token::NE );
			$this->m_state = LexerState::DefaultState;
		}
		else if ( $c == '"' || $c == '\'' )
		{
			$this->ConsumeLiteral();
		}
		else
		{
			// Do nothing
		}
	}
767523
private function _processClassStart() {
		$this->_inClass = true;
		$this->_classLevel = $this->statementStack->count();

		// Check the position of the open curly after the class declaration
		if ($this->_isActive('classOpenCurly')) {
			$pos = $this->_config->getTestProperty('classOpenCurly', 'position');

			$currentToken = $this->tokenizer->getCurrentToken();
			$previousToken = $this->tokenizer->peekPrvsValidToken();

			if ($pos === NEW_LINE) {
				// The previous token should be on the previous line
				$isPosOk = ($previousToken->line < $currentToken->line);
			} else {
				// The previous token should be on the same line
				$isPosOk = ($previousToken->line === $currentToken->line);
			}

			if (!$isPosOk) {
				$tmp = ($pos === SAME_LINE) ? "the previous line." : "a new line.";
				$msg = $this->_getMessage('LEFT_CURLY_POS', $tmp);
				$this->_writeError('classOpenCurly', $msg);
			}
		}
	}
144671
protected function handleSubExpression()
    {
        // Flag, checking for mismatching parentheses
        $clean = false;

        // Pop operators off the operatorStack until its empty, or
        // we find an opening parenthesis, building subexpressions
        // on the operandStack as we go.
        while ($popped = $this->operatorStack->pop()) {

            // ok, we have our matching opening parenthesis
            if ($popped instanceof SubExpressionNode) {
                $clean = true;
                break;
            }

            $node = $this->handleExpression($popped);
            $this->operandStack->push($node);

        }

        // Throw an error if the parenthesis couldn't be matched
        if (!$clean) {
            throw new ParenthesisMismatchException();
        }


        // Check to see if the parenthesis pair was in fact part
        // of a function application. If so, create the corresponding
        // FunctionNode and push it onto the operandStack.
        $previous = $this->operatorStack->peek();
        if ($previous instanceof FunctionNode) {
            $node = $this->operatorStack->pop();
            $operand = $this->operandStack->pop();
            $node->setOperand($operand);
            $this->operandStack->push($node);
        }
    }
112533
function processChildren()
    {
        if ( !is_array( $this->FunctionChildren ) )
        {
            return false;
        }
        foreach ( array_keys( $this->FunctionChildren ) as $childKey )
        {
            $child = $this->FunctionChildren[$childKey];

            if ( $child[0] == eZTemplate::NODE_FUNCTION ) // check child type
            {
                $childFunctionName = $child[2];

                if ( $childFunctionName == 'break' )
                    return true;
                elseif ( $childFunctionName == 'continue' )
                {
                    $this->SkipSequenceIncrement = true;
                    break;
                }
                elseif ( $childFunctionName == 'skip' )
                {
                    $this->SkipSequenceIncrement = true;
                    $this->SkipDelimiter = true;
                    break;
                }
                elseif ( $childFunctionName == 'delimiter' )
                {
                    if ( $this->Delimiter === null )
                        $this->Delimiter = $child;
                    continue;
                }
            }

            $rslt = $this->Tpl->processNode( $child, $this->TextElements, $this->RootNamespace, $this->CurrentNamespace );

            // break/continue/skip might be found in a child function's (usually {if}) children
            if ( is_array( $rslt ) )
            {
                if ( array_key_exists( 'breakFunctionFound', $rslt ) )
                    return true;
                elseif ( array_key_exists( 'continueFunctionFound', $rslt ) )
                {
                    $this->SkipSequenceIncrement = true;
                    break;
                }
                elseif ( array_key_exists( 'skipFunctionFound', $rslt ) )
                {
                    $this->SkipSequenceIncrement = true;
                    $this->SkipDelimiter = true;
                    break;
                }
            }

        } // foreach

        return false;
    }
1202838
public function getOperator()
    {
        $returnValue = null;

        
        if(empty($this->arithmeticOperator)){
        	$property = new core_kernel_classes_Property(RulesRdf::PROPERTY_OPERATION_OPERATOR);
        	$this->arithmeticOperator = $this->getUniquePropertyValue($property);
        }
        $returnValue = $this->arithmeticOperator;
        

        return $returnValue;
    }
1145833
public function process()
    {
        $state = $this->getState();
        $this->pushTrail($this->getRule());

        $className = ucfirst($this->getQtiNature());
        $nsClass = 'qtism\\data\\rules\\' . $className . 'Condition';
        $ruleGetter = "get${className}Rules";
        $statementGetter = "get${className}"; // + 'If'|'ElseIf'|'Else'

        while (count($this->getTrail()) > 0) {

            $rule = $this->popTrail();

            if (get_class($rule) === $nsClass) {

                // Let's try for if.
                $ifStatement = call_user_func(array($rule, $statementGetter . 'If'));
                $ifExpression = $ifStatement->getExpression();
                $exprEngine = new ExpressionEngine($ifExpression, $state);
                $value = $exprEngine->process();

                if ($value !== null && $value->getValue() === true) {
                    // Follow the if.
                    $this->pushTrail(call_user_func(array($ifStatement, $ruleGetter)));
                } else {
                    // Let's try for else ifs.
                    $followElseIf = false;
                    $elseIfStatements = call_user_func(array($rule, $statementGetter . 'ElseIfs'));

                    foreach ($elseIfStatements as $elseIfStatement) {
                        $elseIfExpression = $elseIfStatement->getExpression();
                        $exprEngine->setComponent($elseIfExpression);
                        $value = $exprEngine->process();

                        if ($value !== null && $value->getValue() === true) {
                            // Follow the current else if.
                            $this->pushTrail(call_user_func(array($elseIfStatement, $ruleGetter)));
                            $followElseIf = true;
                            break;
                        }
                    }

                    $elseStatement = call_user_func(array($rule, $statementGetter . 'Else'));

                    if ($followElseIf === false && is_null($elseStatement) === false) {
                        // No else if followed, the last resort is the else.
                        $this->pushTrail(call_user_func(array($elseStatement, $ruleGetter)));
                    }
                }
            } else {
                // $rule is another Rule than OutcomeCondition/ResponseCondition.
                $processor = $this->getRuleProcessorFactory()->createProcessor($rule);
                $processor->setState($state);
                $processor->process();
            }
        }
    }
452928
public function process($expression) {
        $tokens = $this->splitSQLIntoTokens($expression);
        $token_count = count($tokens);
        if ($token_count === 0) {
            return null;
        }

        /*
         * Determine if there is an explicit alias after the AS clause.
         * If AS is found, then the next non-whitespace token is captured as the alias.
         * The tokens after (and including) the AS are removed.
         */
        $base_expr = "";
        $stripped = array();
        $capture = false;
        $alias = false;
        $processed = false;

        for ($i = 0; $i < $token_count; ++$i) {
            $token = $tokens[$i];
            $upper = strtoupper($token);

            if ($upper === 'AS') {
                $alias = array('as' => true, "name" => "", "base_expr" => $token);
                $tokens[$i] = "";
                $capture = true;
                continue;
            }

            if (!$this->isWhitespaceToken($upper)) {
                $stripped[] = $token;
            }

            // we have an explicit AS, next one can be the alias
            // but also a comment!
            if ($capture) {
                if (!$this->isWhitespaceToken($upper) && !$this->isCommentToken($upper)) {
                    $alias['name'] .= $token;
                    array_pop($stripped);
                }
                $alias['base_expr'] .= $token;
                $tokens[$i] = "";
                continue;
            }

            $base_expr .= $token;
        }

        if ($alias) {
            // remove quotation from the alias
            $alias['no_quotes'] = $this->revokeQuotation($alias['name']);
            $alias['name'] = trim($alias['name']);
            $alias['base_expr'] = trim($alias['base_expr']);
        }

        $stripped = $this->processExpressionList($stripped);

        // TODO: the last part can also be a comment, don't use array_pop

        // we remove the last token, if it is a colref,
        // it can be an alias without an AS
        $last = array_pop($stripped);
        if (!$alias && $this->isColumnReference($last)) {

            // TODO: it can be a comment, don't use array_pop

            // check the token before the colref
            $prev = array_pop($stripped);

            if ($this->isReserved($prev) || $this->isConstant($prev) || $this->isAggregateFunction($prev)
                    || $this->isFunction($prev) || $this->isExpression($prev) || $this->isSubQuery($prev)
                    || $this->isColumnReference($prev) || $this->isBracketExpression($prev)|| $this->isCustomFunction($prev)) {

                $alias = array('as' => false, 'name' => trim($last['base_expr']),
                               'no_quotes' => $this->revokeQuotation($last['base_expr']),
                               'base_expr' => trim($last['base_expr']));
                // remove the last token
                array_pop($tokens);
            }
        }

        $base_expr = $expression;

        // TODO: this is always done with $stripped, how we do it twice?
        $processed = $this->processExpressionList($tokens);

        // if there is only one part, we copy the expr_type
        // in all other cases we use "EXPRESSION" as global type
        $type = ExpressionType::EXPRESSION;
        if (count($processed) === 1) {
            if (!$this->isSubQuery($processed[0])) {
                $type = $processed[0]['expr_type'];
                $base_expr = $processed[0]['base_expr'];
                $no_quotes = isset($processed[0]['no_quotes']) ? $processed[0]['no_quotes'] : null;
                $processed = $processed[0]['sub_tree']; // it can be FALSE
            }
        }

        $result = array();
        $result['expr_type'] = $type;
        $result['alias'] = $alias;
        $result['base_expr'] = trim($base_expr);
        if (!empty($no_quotes)) {
            $result['no_quotes'] = $no_quotes;
        }
        $result['sub_tree'] = (empty($processed) ? false : $processed);
        return $result;
    }
690857
public function process()
    {
        $operands = $this->getOperands();

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

        if ($operands->exclusivelyMultipleOrOrdered() === false) {
            $msg = "The Random operator only accepts values with multiple or ordered cardinality.";
            throw new OperatorProcessingException($msg, $this, OperatorProcessingException::WRONG_CARDINALITY);
        }

        $operand = $operands[0];
        $maxIndex = count($operand) - 1;

        return $operand[mt_rand(0, $maxIndex)];
    }
1236912
public function process()
    {
        $operands = $this->getOperands();

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

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

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

        $qtiFuncName = MathFunctions::getNameByConstant($this->getExpression()->getName());
        $methodName = 'process' . ucfirst($qtiFuncName);
        $result = call_user_func_array(array($this, $methodName), array());

        if ($result instanceof QtiFloat && is_nan($result->getValue()) === true) {
            // outside the domain of the function.
            return null;
        } else {
            return $result;
        }
    }
692880
protected function processAssignment($base_expr) {
        $assignment = $this->processExpressionList($this->splitSQLIntoTokens($base_expr));

        // TODO: if the left side of the assignment is a reserved keyword, it should be changed to colref

        return array('expr_type' => ExpressionType::EXPRESSION, 'base_expr' => trim($base_expr),
                     'sub_tree' => (empty($assignment) ? false : $assignment));
    }
390374
protected function _processExpressions()
    {
        $types = [];
        $typeMap = $this->getTypeMap();

        $columns = $this->_columnNames();
        foreach ($columns as $c) {
            if (!is_scalar($c)) {
                continue;
            }
            $types[$c] = $typeMap->type($c);
        }

        $types = $this->_requiresToExpressionCasting($types);

        if (empty($types)) {
            return;
        }

        foreach ($this->_values as $row => $values) {
            foreach ($types as $col => $type) {
                /* @var \Cake\Database\Type\ExpressionTypeInterface $type */
                $this->_values[$row][$col] = $type->toExpression($values[$col]);
            }
        }
        $this->_castedExpressions = true;
    }
360049
private function _processClassStatement() {
		$isAfterScopeResolutionOperator = $this->tokenizer->checkPreviousToken(T_DOUBLE_COLON);
		if ($isAfterScopeResolutionOperator) {
			return;
		}

		// Check PHPDoc presence
		$this->_checkDocExists(T_CLASS);

		$this->_ncssTotalClasses ++;
		$this->_ncssFileClasses ++;

		// Test if there is more than one class per file
		if ($this->_isActive('oneClassPerFile') && $this->_ncssFileClasses > 1) {
			$msg = $this->_getMessage('ONE_CLASS_PER_FILE', $this->_currentFilename);
			$this->_writeError('oneClassPerFile', $msg);
		}

		// Reset the default values
		$this->_inFunction = false;
		$this->_nbFunctionParameters = 0;
		$this->_functionParameters = array();
		$this->_inFunctionStatement = false;
		$this->_functionReturns = false;
		$this->_functionThrows = false;
		$this->_inControlStatement = false;
		$this->_currentStatement = false;
		$this->_inClassStatement = true;

		// skip until T_STRING representing the class name
		while (!$this->tokenizer->checkCurrentToken(T_STRING)) {
			$this->tokenizer->getNextToken();
		}

		$token = $this->tokenizer->getCurrentToken();
		$classname = $token->text;
		$this->_currentClassname = $classname;

		// Test that the class name matches the file name
		$this->_checkTypeNameFileNameMatch($classname);

		// Check class naming
		$this->_checkClassNaming($classname);

		$this->_checkWhiteSpaceAfter($classname);
	}
1183185
public function process()
    {
        $operands = $this->getOperands();

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

        if ($operands->exclusivelyMultipleOrOrdered() === false) {
            $msg = "The StatsOperator operator only accepts operands with a multiple or ordered cardinality.";
            throw new OperatorProcessingException($msg, $this, OperatorProcessingException::WRONG_CARDINALITY);
        }

        if ($operands->exclusivelyNumeric() === false) {
            $msg = "The StatsOperator operator only accepts operands with a multiple or ordered cardinality.";
            throw new OperatorProcessingException($msg, $this, OperatorProcessingException::WRONG_BASETYPE);
        }

        $qtiFuncName = Statistics::getNameByConstant($this->getExpression()->getName());
        $methodName = 'process' . ucfirst($qtiFuncName);

        return call_user_func_array(array($this, $methodName), array());
    }