@param string $operator

@return FilterOperators

@throws \InvalidArgumentException
540082
public function addOperator(string $operator): self
    {
        $this->validateOperator($operator);
        if (!in_array($operator, $this->operators)) {
            $this->operators[] = $operator;
        }

        return $this;
    }
418704
protected function validateOperators($operators, array &$invalid = [])
    {
        $defaultOperators = $this->getDefaultOperators();

        foreach ($operators as $operator) {
            if (!\in_array($operator, $defaultOperators, true)) {
                $invalid[] = $operator;
            }
        }

        return 0 === \count($invalid);
    }
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));
        }
    }
1268270
public function where($key, $operator = null, $value = null)
    {
        return $this->filter($this->operatorForWhere(...func_get_args()));
    }
1365673
private function filtersDefaultOperators(array $filters): array
    {
        foreach ($filters as $key => $filter) {
            // give the filter default operators, according to its type
            if (
                (!array_key_exists('operators', $filter)) ||
                (empty($filter['operators']))
            ) {
                $builderType = $filter['type'];

                switch ($builderType) {
                    case 'string':
                        $filter['operators'] = [
                            'equal', 'not_equal', 'is_null', 'is_not_null',
                            'begins_with', 'not_begins_with', 'contains', 'not_contains', 'ends_with', 'not_ends_with', 'is_empty', 'is_not_empty', // specific to strings
                        ];

                        break;
                    case 'integer':
                    case 'double':
                    case 'date':
                    case 'time':
                    case 'datetime':
                        $filter['operators'] = [
                            'equal', 'not_equal', 'is_null', 'is_not_null',
                            'less', 'less_or_equal', 'greater', 'greater_or_equal', 'between', 'not_between', // specific to numbers and dates
                        ];

                        break;
                    case 'boolean':
                        $filter['operators'] = [
                            'equal', 'not_equal', 'is_null', 'is_not_null',
                        ];

                        break;
                }
            }
            $filters[$key] = $filter;
        }

        return $filters;
    }
372422
private function setOperator($operator)
    {
        if (!in_array($operator, ['=', '!=', '~', '!~', '!', '?'], true)) {
            throw new InvalidMARCspecException(
                InvalidMARCspecException::SS.
                InvalidMARCspecException::OPERATOR,
                $operator
            );
        }
        $this->operator = $operator;
    }
231239
public function setOperators(array $operators)
    {
        $invalid = [];
        if (!$this->validateOperators($operators, $invalid)) {
            throw new \InvalidArgumentException(\sprintf('Trying to set invalid operator(s) "%s" for filter "%s"', \implode(', ', $operators), $this->getName()));
        }
        $this->operators = $operators;

        return $this;
    }
1001690
protected function normalizeComparison($operator)
    {
        switch (strtolower($operator)) {
            case '<':
            case 'lt':
                return '<';
            case '<=':
            case 'lte':
                return '<=';
            case '>':
            case 'gt':
                return '>';
            case '>=':
            case 'gte':
                return '>=';
            case '~':
            case '~=':
            case '=~':
            case 'regex':
            case 'regexp':
                return "regexp";
            // LIKE
            case 'like':
                return "like";
            case '||':
            case 'fulltext':
            case 'fulltext_boolean':
                return 'fulltext';
            case '<>':
            case '!=':
            case 'ne':
            case 'not':
                return '!=';
            case '=':
            case 'eq':
                return '=';
            default:
                throw new QueryException(sprintf('Query does not supports comparison operator "%s" in query "%s"', $operator, $this->model()->entity()));
        }
    }
527882
protected function filterAndCondition(array $data, $operator, $operands)
    {
        foreach ($operands as $operand) {
            if (is_array($operand)) {
                $data = $this->filterCondition($data, $operand);
            }
        }

        return $data;
    }
575410
private function getDynamoDbOperator(IndexQueryFilterOperator $operator): string
    {
        switch ($operator->getValue()) {
            case IndexQueryFilterOperator::EQUAL_TO:
                return '=';

            case IndexQueryFilterOperator::NOT_EQUAL_TO:
                return '<>';

            case IndexQueryFilterOperator::GREATER_THAN:
                return '>';

            case IndexQueryFilterOperator::GREATER_THAN_OR_EQUAL_TO:
                return '>=';

            case IndexQueryFilterOperator::LESS_THAN:
                return '<';

            case IndexQueryFilterOperator::LESS_THAN_OR_EQUAL_TO:
                return '<=';

            default:
                return '=';
        }
    }
1075058
public function removeFilter($operator, $attribute)
    {
        if (isset($this->filters[$operator][$attribute])) {
            unset($this->filters[$operator][$attribute]);
        }
        return $this;
    }
1118279
public function setOperator($operator)
    {
        if ($this->allowedOperators && !in_array($operator, $this->allowedOperators)) {
            throw new UnsupportedParameterException('This constraint only accepts operators: ' . implode(',', $this->allowedOperators));
        }

        $this->operator = $operator;
        return $this;
    }
303358
private static function filterAndOr($operation, QueryBuilder $queryBuilder)
    {
        $children = $operation['children'];

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

        $whereOperation = strtolower($operation['operation']) . 'Where';

        foreach ($children as $child) {
            $queryBuilder->{$whereOperation}(static::calculateSubFilter($child, $queryBuilder));
        }
    }
1366882
protected function mapConditionOperator(string $operator) : string
    {
        ConditionOperator::validate($operator);

        static $dbOperatorMap = [
            ConditionOperator::EQUALS                           => BinOp::EQUAL,
            ConditionOperator::NOT_EQUALS                       => BinOp::NOT_EQUAL,
            ConditionOperator::IN                               => BinOp::IN,
            ConditionOperator::NOT_IN                           => BinOp::NOT_IN,
            ConditionOperator::LESS_THAN                        => BinOp::LESS_THAN,
            ConditionOperator::LESS_THAN_OR_EQUAL               => BinOp::LESS_THAN_OR_EQUAL,
            ConditionOperator::GREATER_THAN                     => BinOp::GREATER_THAN,
            ConditionOperator::GREATER_THAN_OR_EQUAL            => BinOp::GREATER_THAN_OR_EQUAL,
            ConditionOperator::STRING_CONTAINS                  => BinOp::STR_CONTAINS,
            ConditionOperator::STRING_CONTAINS_CASE_INSENSITIVE => BinOp::STR_CONTAINS_CASE_INSENSITIVE,
        ];

        return $dbOperatorMap[$operator];
    }
895017
public function defineOperator(string $operator, callable $transformer): void
    {
        unset($this->inlineOperators[$operator]);
        $this->operators[$operator] = $transformer;
    }
18425
private function getOperator($operator)
    {
        $operators = $this->getOperators();

        $key = array_search(strtolower($operator), $operators);

        if ($key !== false && array_key_exists($key, $operators)) {
            return $operators[$key];
        }

        $operators = implode(', ', $operators);

        $message = "Operator: $operator cannot be used in an LDAP query. Available operators are $operators";

        throw new InvalidQueryOperator($message);
    }
958525
public function operation($operation)
    {
        $existing = $this->operations->findByIdentifier($operation);

        if ($existing) {
            return $existing;
        }

        $scaffoldClass = OperationScaffolder::getClassFromIdentifier($operation);
        if (!$scaffoldClass) {
            throw new InvalidArgumentException(
                sprintf(
                    'Invalid operation: %s added to %s',
                    $operation,
                    $this->getDataObjectClass()
                )
            );
        }
        /**
         * @var OperationScaffolder $scaffolder
         */
        $scaffolder = Injector::inst()->createWithArgs($scaffoldClass, [$this->getDataObjectClass()]);

        $this->operations->push(
            $scaffolder->setChainableParent($this)
        );

        return $scaffolder;
    }