Get an operator checker callback.

@param  string $key
@param  string $operator
@param  mixed  $value

@return \Closure
162113
protected function operatorForWhere($key, $operator, $value)
    {
        return function ($item) use ($key, $operator, $value) {

            $retrieved = ArrayHelper::dataGet($item, $key);

            switch ($operator) {
                default:
                case '=':
                case '==':
                    return $retrieved == $value;
                case '!=':
                case '<>':
                    return $retrieved != $value;
                case '<':
                    return $retrieved < $value;
                case '>':
                    return $retrieved > $value;
                case '<=':
                    return $retrieved <= $value;
                case '>=':
                    return $retrieved >= $value;
                case '===':
                    return $retrieved === $value;
                case '!==':
                    return $retrieved !== $value;
            }
        };
    }
1181864
public function whereCmp($field, $operator, $value)
    {
        $bind_key = strpos($field, '.') ? strtr($field, '.', '_') : $field;
        $normalizedField = preg_replace('#\w+#', '[\\0]', $field);

        if ($operator === '=') {
            if ($value === null) {
                $this->_conditions[] = $normalizedField . ' IS NULL';
            } else {
                $this->_conditions[] = $normalizedField . '=:' . $bind_key;
                $this->_bind[$bind_key] = $value;
            }
        } elseif ($operator === '~=') {
            if ($value === 0 || $value === 0.0) {
                $this->_conditions[] = "$normalizedField IS NULL OR $normalizedField=0";
            } elseif ($value === '') {
                $this->_conditions[] = "$normalizedField IS NULL OR $normalizedField=''";
            } else {
                $this->_conditions[] = $normalizedField . '=' . $bind_key;
                $this->_bind[$bind_key] = $value;
            }
        } elseif ($operator === '!=' || $operator === '<>') {
            if ($value === null) {
                $this->_conditions[] = $normalizedField . ' IS NOT NULL';
            } else {
                $this->_conditions[] = $normalizedField . $operator . ':' . $bind_key;
                $this->_bind[$bind_key] = $value;
            }
        } elseif (in_array($operator, ['>', '>=', '<', '<='], true)) {
            $this->_conditions[] = $normalizedField . $operator . ':' . $bind_key;
            $this->_bind[$bind_key] = $value;
        } else {
            throw new MisuseException(['unknown `:operator` operator', 'operator' => $operator]);
        }

        return $this;
    }
172767
private function prepareOperator(?string $operator, $value): string
    {
        $operator = strtoupper($operator);

        if (!$operator) {
            $operator = is_array($value) ? 'IN' : '=';
        }

        if ($operator === 'IN' and !is_array($value)) {
            $operator = '=';
        }

        if ($operator !== 'IN' and is_array($value)) {
            throw new SqlException('Value could not be an array in condition for operator `' . $operator . '`.');
        }

        return $operator;
    }
654437
protected static function operatorForWhere($key, $operator, $value)
    {
        return function ($item) use ($key, $operator, $value) {
            $retrieved = static::get($item, $key);

            switch ($operator) {
                default:
                case '=':
                case '==':  return $retrieved == $value;
                case '!=':
                case '<>':  return $retrieved != $value;
                case '<':   return $retrieved < $value;
                case '>':   return $retrieved > $value;
                case '<=':  return $retrieved <= $value;
                case '>=':  return $retrieved >= $value;
                case '===': return $retrieved === $value;
                case '!==': return $retrieved !== $value;
            }
        };
    }
430749
public function where($key, $operatorOrValue, $value=null)
    {

        if ($key == 'page_type' && $value === null) {
            return $this->pageType($operatorOrValue);
        }

        if ($this->isPageKey($key)) {
            $this->query->where($key, $operatorOrValue, $value);
            return $this;
        }

        if ($this->isConfigKey($key)) {
            return $this->addConfigWhere($key, $operatorOrValue, $value);
        }

        return $this;

    }
457809
protected function replaceOperatorForNulLValue(OperatorInterface $Operator, $value)
    {
        if ($value === null) {
            if ($Operator->getType() === Equal::TYPE_NAME) {
                $className = CriteriaBuilder::getOperatorClassNameBySqlOperator(Is::TYPE_AS_SQL);
                $Operator = $this->getFactoryWorker()->buildCriteriaOperator($className);
            } elseif ($Operator->getType() === NotEqual::TYPE_NAME) {
                $className = CriteriaBuilder::getOperatorClassNameBySqlOperator(NotIs::TYPE_AS_SQL);
                $Operator = $this->getFactoryWorker()->buildCriteriaOperator($className);
            }
        }

        return $Operator;
    }
687401
protected function getTransposeClosure($operator, $value)
    {
        $value = hexdec($value) * ($operator === '-' ? -1 : 1);
        $converter = $this->converter;

        return function ($matches) use ($value, $converter) {
            return $converter->toUTF8Character(
                $converter->toUnicodeCodepoint($matches[0]) + $value
            );
        };
    }
864160
protected function whereHandler($key, $operator = null, $value = null, $joiner = 'AND')
    {
        $key = $this->addTablePrefix($key);
        $this->statements['wheres'][] = compact('key', 'operator', 'value', 'joiner');
        return $this;
    }
1205730
public function where($key, $value = true, $operator = '=')
    {
        return $this->addCondition($key, $value, $operator, 'where');
    }
1195276
public function where($field, $operator = null, $value = null) {
        if (strlen($field) && is_null($operator) && is_null($value)) {
            // For RAW string
            array_push($this->_where, $field);
        } else {
            if (is_null($value)) {
                $value = $operator;
                $operator = '=';
            }

            if (is_array($value)) {
                $str = '(';
                
                for ($i = 0; $i < count($value); $i++) {
                    $d = $value[$i];
                    $str .= is_numeric($d) ? $d : "'$d'";
                    $str .= count($value) === $i + 1 ? '' : ', ';
                }
                
                $str .= ')';
                
                $value = $str;
                
                array_push($this->_where, $field . ' ' . $operator . $value);
            } else {
                $value = (string)$value;
                array_push($this->_where, $field . ' ' . $operator . (!strcasecmp($operator, 'in') ? " ($value)" : ' \'' . $value . '\''));
            }
        }
        
        return $this;
    }
534337
protected function checkValue($value, $key = null)
    {
        if ($value != null) {
            if ($key !== null) {
                return isset($value[$key]) ? $value[$key] : null;
            }

            return $value;
        }
    }
524543
public function where($key, $operator, $value)
    {
        if (string_has($operator, 'IN') || string_has($operator, 'in')) {
            return $this->whereIn($key, $value);
        }

        $this->where[] = 'AND '.$key.' '.$operator.' '.'?';
        $this->bindings[] = $value;

        return $this;
    }
854759
public function orWhereIn($key, $value, $operator = 'IN')
    {
        $exp = explode(',', $value);
        $this->where[] = 'OR OR'.$key.' '.$operator.' ('.$this->createPlaceHolder($exp).') ';

        foreach ($exp as $key => $val) {
            $this->bindings[$key] = $val;
        }

        return $this;
    }
239706
public function whereNot($key, $operator = null, $value = null): IQueryBuilderHandler
    {
        // If two params are given then assume operator is =
        if (\func_num_args() === 2) {
            $value = $operator;
            $operator = '=';
        }

        return $this->whereHandler($key, $operator, $value, 'AND NOT');
    }
910346
public static function find_one_by($column, $value = null, $operator = '=')
	{
		$config = array(
			'limit' => 1,
		);

		if (is_array($column) or ($column instanceof \Closure))
		{
			$config['where'] = $column;
		}
		else
		{
			$config['where'] = array(array($column, $operator, $value));
		}

		$result = static::find($config);

		if ($result !== null)
		{
			return reset($result);
		}

		return null;
	}
288038
public function buildCondition($key, $value)
    {
        [$operator, $attribute] = $this->parseFilterKey($key);

        if (is_array($value)) {
            return [$this->getSql() => $this->ensureConditionValueIsValid('in', $value)];
        }

        $operatorMap = [
            'eq' => '=',
            'ne' => '!=',
        ];

        return [$operatorMap[$operator] ?? $operator, $this->getSql(), $this->ensureConditionValueIsValid($operator, $value)];
    }
916399
protected function operatorForWhere($key, $operator, $value)
    {
        return function ($item) use ($key, $operator, $value) {
            $retrieved = data_get($item, $key);

            switch ($operator) {
                default:
                case '=':
                case '==':
                    return $retrieved == $value;
                case '!=':
                case '<>':
                    return $retrieved != $value;
                case '<':
                    return $retrieved < $value;
                case '>':
                    return $retrieved > $value;
                case '<=':
                    return $retrieved <= $value;
                case '>=':
                    return $retrieved >= $value;
                case '===':
                    return $retrieved === $value;
                case '!==':
                    return $retrieved !== $value;
            }
        };
    }