Returns true if a field meets the required conditions, false otherwise.

@param string $operator the requirement/condition
@param string $uservalue the user's value
@param string $value the value required
@return boolean True if conditions are met
332486
protected static function is_field_condition_met($operator, $uservalue, $value) {
        if ($uservalue === false) {
            // If the user value is false this is an instant fail.
            // All user values come from the database as either data or the default.
            // They will always be a string.
            return false;
        }
        $fieldconditionmet = true;
        // Just to be doubly sure it is a string.
        $uservalue = (string)$uservalue;
        switch($operator) {
            case self::OP_CONTAINS:
                $pos = strpos($uservalue, $value);
                if ($pos === false) {
                    $fieldconditionmet = false;
                }
                break;
            case self::OP_DOES_NOT_CONTAIN:
                if (!empty($value)) {
                    $pos = strpos($uservalue, $value);
                    if ($pos !== false) {
                        $fieldconditionmet = false;
                    }
                }
                break;
            case self::OP_IS_EQUAL_TO:
                if ($value !== $uservalue) {
                    $fieldconditionmet = false;
                }
                break;
            case self::OP_STARTS_WITH:
                $length = strlen($value);
                if ((substr($uservalue, 0, $length) !== $value)) {
                    $fieldconditionmet = false;
                }
                break;
            case self::OP_ENDS_WITH:
                $length = strlen($value);
                $start = $length * -1;
                if (substr($uservalue, $start) !== $value) {
                    $fieldconditionmet = false;
                }
                break;
            case self::OP_IS_EMPTY:
                if (!empty($uservalue)) {
                    $fieldconditionmet = false;
                }
                break;
            case self::OP_IS_NOT_EMPTY:
                if (empty($uservalue)) {
                    $fieldconditionmet = false;
                }
                break;
        }
        return $fieldconditionmet;
    }
237717
public function orHaving($column, $operator = null, $value = null)
    {
        [$value, $operator] = $this->prepareValueAndOperator(
            $value, $operator, func_num_args() === 2
        );

        return $this->having($column, $operator, $value, 'or');
    }
1296114
public function every($key, $operator = null, $value = null)
    {
        if (func_num_args() === 1) {
            $callback = $this->valueRetriever($key);

            foreach ($this->items as $k => $v) {
                if (!$callback($v, $k)) {
                    return false;
                }
            }

            return true;
        }

        if (func_num_args() === 2) {
            $value = $operator;

            $operator = '=';
        }

        return $this->every($this->operatorForWhere($key, $operator, $value));
    }
627752
public function whereCmp($field, $operator, $value)
    {
        if ($operator === '=') {
            $this->_filters[] = [$field => $this->normalizeValue($field, $value)];
        } elseif ($operator === '~=') {
            if ($this->_types && !isset($this->_types[$field])) {
                throw new InvalidArgumentException(['`:field` field is not exist in `:collection` collection',
                    'field' => $field,
                    'collection' => $this->getSource()
                ]);
            }

            if (is_scalar($value)) {
                if (is_int($value)) {
                    $this->_filters[] = [$field => ['$in' => [(string)$value, (int)$value]]];
                } elseif (is_float($value)) {
                    $this->_filters[] = [$field => ['$in' => [(string)$value, (float)$value]]];
                } else {
                    $this->_filters[] = [$field => ['$in' => [(string)$value, (int)$value, (float)$value]]];
                }
            } else {
                throw new InvalidValueException(['`:operator` operator is not  valid: value must be scalar value', 'operator' => $operator]);
            }
        } else {
            $operator_map = ['>' => '$gt', '>=' => '$gte', '<' => '$lt', '<=' => '$lte', '!=' => '$ne', '<>' => '$ne'];
            if (!isset($operator_map[$operator])) {
                throw new InvalidValueException(['unknown `:operator` operator', 'operator' => $operator]);
            }
            $this->_filters[] = [$field => [$operator_map[$operator] => $this->normalizeValue($field, $value)]];
        }

        return $this;
    }
992400
protected function validate(array $values, $operator)
    {
        if (!in_array($operator, array('=', '!='))) {
            return $this->translation->text('Unsupported operator');
        }

        if (count($values) != 1) {
            return $this->translation->text('@field has invalid value', array(
                '@field' => $this->translation->text('Condition')));
        }

        $scope = filter_var(reset($values), FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE);

        if (!isset($scope)) {
            return $this->translation->text('@field has invalid value', array(
                '@field' => $this->translation->text('Condition')));
        }

        return true;
    }
78096
protected function checkValue($testedValue, $operator, $argument)
    {
        switch ($operator) {
            case FilterOperation::OPERATOR_EQ:
                return $testedValue == $argument;
            case FilterOperation::OPERATOR_GT:
                return $testedValue > $argument;
            case FilterOperation::OPERATOR_GTE:
                return $testedValue >= $argument;
            case FilterOperation::OPERATOR_LT:
                return $testedValue < $argument;
            case FilterOperation::OPERATOR_LTE:
                return $testedValue <= $argument;
            case FilterOperation::OPERATOR_NOT_EQ:
                return $testedValue != $argument;
            case FilterOperation::OPERATOR_STR_CONTAINS:
                return strpos($testedValue, $argument) !== false;
            case FilterOperation::OPERATOR_STR_STARTS_WITH:
                return strpos($testedValue, $argument) === 0;
            case FilterOperation::OPERATOR_STR_ENDS_WITH:
                return strpos($testedValue, $argument, strlen($testedValue) - strlen($argument)) !== false;
            default:
                throw new InvalidArgumentException(
                    'Unsupported operator ' . $operator
                );
        }
    }
790997
public function userHasAccess(User $user)
    {
        if ($this->getWhitelisted() === false) {
            return true;
        }

        $criteria = Criteria::create()
                ->where(Criteria::expr()->eq('user', $user))
                ->setMaxResults(1);

        $serverUsers = $this->users->matching($criteria);
        if ($serverUsers->count() === 0) {
            return false;
        }

        $serverUser = $serverUsers->first();

        if ($serverUser->getBanned() === true) {
            return false;
        }

        if ($this->getRequiresApproval() === true && $serverUser->getApproved() === false) {
            return false;
        }

        return true;
    }
991309
public function where($column, $operator = null, $value = null, $boolean = 'and')
    {
        // Tratar alias do _id
        $column = ($column == 'id') ? '_id' : $column;

        // Here we will make some assumptions about the operator. If only 2 values are
        // passed to the method, we will assume that the operator is an equals sign
        // and keep going. Otherwise, we'll require the operator to be passed in.
        list($value, $operator) = $this->prepareValueAndOperator(
            $value, $operator, func_num_args() == 2
        );

        // If the columns is actually a Closure instance, we will assume the developer
        // wants to begin a nested where statement which is wrapped in parenthesis.
        // We'll add that Closure to the query then return back out immediately.
        if ($column instanceof Closure) {
            return $this->whereNested($column, $boolean);
        }

        // If the given operator is not found in the list of valid operators we will
        // assume that the developer is just short-cutting the '=' operators and
        // we will set the operators to '=' and set the values appropriately.
        if ($this->invalidOperator($operator)) {
            list($value, $operator) = [$operator, '='];
        }

        // If the value is a Closure, it means the developer is performing an entire
        // sub-select within the query and we will need to compile the sub-select
        // within the where clause to get the appropriate query record results.
        // BRUNO-AKI
        //if ($value instanceof Closure) {
        //    return $this->whereSub($column, $operator, $value, $boolean);
        //}

        // If the value is "null", we will just assume the developer wants to add a
        // where null clause to the query. So, we will allow a short-cut here to
        // that method for convenience so the developer doesn't have to check.
        if (is_null($value)) {
            return $this->whereNull($column, $boolean, $operator !== '=');
        }

        // Now that we are working with just a simple query we can put the elements
        // in our array and add the query binding to our array of bindings that
        // will be bound to each SQL statements when it is finally executed.
        $type = 'Basic';

        $this->wheres[] = compact(
            'type', 'column', 'operator', 'value', 'boolean'
        );

        return $this;
    }
745109
private static function checkInlineOperator(&$operator, &$value, $settings = [])
    {
        if (is_array($value)) {
            return;
        }

        // Boolean does not provide inline operations.
        if (Arr::get($settings, 'filter') === 'boolean') {
            return;
        }

        $value_array = explode(' ', trim($value), 2);

        if (count($value_array) == 1) {
            return;
        }

        $check_operator = array_shift($value_array);

        if (self::checkOperator(Arr::get($settings, 'filter', 'string'), $check_operator)) {
            $operator = $check_operator;
            $value = array_shift($value_array);
        }
    }
1075738
private function setSimpleOperator($operator, $value)
    {
        if (empty($operator)) {
            throw new InvalidArgumentException('The operator must not be null' .
                ' or empty.');
        }

        if (is_null($value) || $value === '') {
            throw new InvalidArgumentException('The value string must not be' .
                ' null or empty');
        }

        $this->simpleOperator = $operator;
        $this->simpleValue = $value;
    }
899354
public static function getUserStringProp(User $user, $property)
    {
        $value = $user->getPropertyValues($property);
        return empty($value) ? '' : current($value);
    }
1265245
public function acceptsValue($value): bool {
		switch ($this->operator) {
			case CriteriaComparator::OPERATOR_NOT_IN:
				if ($value === null) return true;
				return !$this->in($value);
			case CriteriaComparator::OPERATOR_IN:
				if ($value === null) return false;
				return !$this->in($value);
				
			case CriteriaComparator::OPERATOR_CONTAINS_NOT:
				ArgUtils::assertTrue(is_array($value));
				
				foreach ($value as $relationEntry) {
					if ($this->in($relationEntry)) return false;
				}
				
				return true;
			case CriteriaComparator::OPERATOR_CONTAINS:
				ArgUtils::assertTrue(is_array($value));
				
				foreach ($value as $relationEntry) {
					if (!$this->in($relationEntry)) return false;
				}
				
				return true;
		}
	}
1133742
public function isSelectedValue($dataValue, $userValue)
    {
        if (!$this->isMultiple() || !is_array($userValue)) {
            return parent::isSelectedValue($dataValue, $userValue);
        }
        
        return in_array($dataValue, $userValue);
    }
290314
public function orWhere($column, $value, $operator = self::EQUALS, $quote = null)
    {
        return $this->orCriteria($this->where, $column, $value, $operator, $quote);
    }
521366
public function having($column, $operator = '=', $value = null)
    {
        $this->havingType = 'AND';

        return $this->addCondition('having', $column, $operator, $value);
    }
408529
public static function compare($a, $b, string $operator): bool
    {
        switch ($operator) {
            case '>':
                return $a > $b;
            case '>=':
                return $a >= $b;
            case '=':
            case '==':
                return $a == $b;
            case '===':
                return $a === $b;
            case '<=':
                return $a <= $b;
            case '<':
                return $a < $b;
            case '!=':
            case '<>':
                return $a != $b;
            case '!==':
                return $a !== $b;
            default:
                throw new InvalidArgumentException(sprintf('Invalid operator "%s" provided', $operator));
        }
    }
144131
public function condition($field, $value = NULL, $expressionOperator = NULL)
    {

        if (!isset($expressionOperator)) {
            if (is_array($value)) {
                $expressionOperator = 'IN';
            }
            else {
                $expressionOperator = '=';
            }
        }
        $this->conditions[] = array(
            'field' => $field,
            'value' => $value,
            'operator' => $expressionOperator,
        );
        return $this;
    }