Gets the resulting type of the expression
@return Type
@throws InvalidOperationException
164638
public function getResultingType() : \Dms\Core\Persistence\Db\Schema\Type\Type
    {
        throw InvalidOperationException::methodCall(__METHOD__, 'Tuple cannot be used a standalone expression');
    }
894490
public ExpressionType getExpressionType() {
        try { //TODO: cache expression type ?
            final ExpressionType expressionType = node.firstChildAccept(new ExpressionTypeEvaluationVisitor(), null);
            return expressionType;
        } catch (IllegalArgumentException e) {
            throw new IllegalArgumentException("Please report this bug: Can not determine type of XPath:" + xpath, e);
        }
    }
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;
        }
    }
833232
public function getExpression()
    {
        $returnValue = null;

        
		common_Logger::i('Evaluating rule '.$this->getLabel().'('.$this->getUri().')', array('Generis Rule'));
         if(empty($this->expression)){
         	$property = new core_kernel_classes_Property(RulesRdf::PROPERTY_RULE_IF);
         	$this->expression = new core_kernel_rules_Expression($this->getUniquePropertyValue($property)->getUri() ,__METHOD__);
        }
        $returnValue = $this->expression;
        

        return $returnValue;
    }
1063627
public function getOperator()
    {
        $this->setPrefixes();

        if ( ! empty($this->operator)) {
            return $this->operator;
        }

        if (in_array($this->getPrefix(), $this->smartPrefixes)) {
            $this->operator = 'SMART';
        } else if (in_array($this->getPrefix(), $this->globePrefixes)) {
            $this->operator = 'GLOBE';
        } else if (in_array($this->getPrefix(), $this->sunPrefixes)) {
            $this->operator = 'SUN';
        } else {
            $this->operator = 'UNKNOWN';
        }

        return $this->operator;
    }
904933
public function getReturnType(): Type
    {
        if (! isset($this->returnType)) {
            $this->returnType = app(DefinitionNodeConverter::class)->toType(
                $this->field->type
            );
        }

        return $this->returnType;
    }
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);
            }
        }
    }
21698
public function getAtomizedValueType()
	{
		if ( $this->IsNode )
		{
			switch ( $this->TypeCode )
			{
				case XmlTypeCode::Text:
				case XmlTypeCode::ProcessingInstruction:
				case XmlTypeCode::Comment:
				case XmlTypeCode::UntypedAtomic:
					return Types::$UntypedAtomicType;

				default:

					if ( ! is_null( $this->SchemaType ) )
						return $this->SchemaType->Datatype->ValueType;
					else if ( ! is_null( $this->SchemaElement ) )
					{
						if ( ! is_null( $this->SchemaElement->ElementSchemaType ) && ! is_null( $this->SchemaElement->ElementSchemaType->Datatype ) )
							return $this->SchemaElement->ElementSchemaType->Datatype->ValueType;
					}
					else if ( ! is_null( $this->SchemaAttribute ) )
					{
						if ( ! is_null( $this->SchemaAttribute->AttributeSchemaType ) && ! is_null( $this->SchemaAttribute->AttributeSchemaType->Datatype ) )
							return $this->SchemaAttribute->AttributeSchemaType->Datatype->ValueType;
					}
					return Types::$UntypedAtomicType;
			}
		}
		else
			return $this->ItemType;
	}
1307537
public function inputType()
    {
        if ($this->inputType === null) {
            $this->inputType = $this->resolveInputType();
        }

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

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

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

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

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

        $call = ($this->getExpression()->isCaseSensitive() === true) ? 'mb_strpos' : 'mb_stripos';

        return new QtiBoolean($call($operand2->getValue(), $operand1->getValue(), 0, 'UTF-8') !== false);
    }
829556
public function getOperation()
    {
        switch ($this->operation['type']) {
            case self::QUERY_UPDATE :
                return AnDomain::OPERATION_UPDATE;
            case self::QUERY_DELETE :
                return AnDomain::OPERATION_DELETE;
            default :
                return AnDomain::OPERATION_FETCH;
        }
    }
75886
public function getType()
    {
        $sql = $this->getSql();

        $type = strtok(strtolower(trim($sql)), ' ');
        $type = preg_replace ('/[^a-z]/i', '', $type);

        $allowedTypes = [
            self::QUERY_TYPE_SELECT,
            self::QUERY_TYPE_INSERT,
            self::QUERY_TYPE_UPDATE,
            self::QUERY_TYPE_DELETE,
            self::QUERY_TYPE_TRUNCATE,
        ];

        if (!in_array($type, $allowedTypes)) {
            throw new RuntimeException('Invalid query type');
        }

        return $type;
    }
747364
public function getType()
    {
        if (!empty($this->type)) {
            return $this->type;
        }

        if ($this->getDbColumnJoin()) {
            // best guess
            return self::TYPE_TEXT;
        }

        if ($this->getEnumColumnValues()) {
            // best guess
            return self::TYPE_ENUM;
        }

        if (!empty($this->columnType)) {
            // best guess
            $type = strtolower($this->columnType);
            if (strpos($type, 'datetime') !== false) {
                return self::TYPE_DATETIME;
            } elseif (strpos($type, 'timestamp') !== false) {
                return self::TYPE_TIMESTAMP;
            } elseif (strpos($type, 'date') !== false) {
                return self::TYPE_DATE;
            } elseif (strpos($type, 'time') !== false) {
                return self::TYPE_TIME;
            } elseif (strpos($type, 'float') !== false) {
                return self::TYPE_FLOAT;
            } elseif (strpos($type, 'decimal') !== false) {
                return self::TYPE_FLOAT;
            } elseif (strpos($type, 'int') !== false) {
                return self::TYPE_NUMBER;
            } elseif (strpos($type, 'binary') !== false) {
                return self::TYPE_BINARY;
            }
        }

        return self::TYPE_TEXT;
    }
511399
public function getType() : ?string 
    {
        if ( ! $this->hasType()) {
            $this->setType($this->getDefaultType());
        }
        return $this->type;
    }
640261
public function getResultingType() : \Dms\Core\Persistence\Db\Schema\Type\Type
    {
        return Integer::normal();
    }
562644
public function getCurrentType()
    {
        if (null !== $index = $this->getCurrencyIndex()) {
            return $index->getType();
        }

        $types = $this->repository->listIndexableEntityTypes();
        $type = array_shift($types);

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

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

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

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

        return new QtiBoolean($operands[0]->getValue() <= $operands[1]->getValue());
    }