{@inheritdoc}

@param callable $condition Callback condition.

@return DictionaryContract
483600
public function reject( $condition ) {
		return $this->filter( function ( $v, $k ) use ( $condition ) {
			return ! call_user_func( $condition, $v, $k );
		} );
	}
8536
public function join($condition, string $expression = null): object
    {
        if (!is_array($condition)) {
            $condition = [$condition => $expression];
        }
        $this->container[$this->id]['s']['join'] = array_merge($this->container[$this->id]['s']['join'], $condition);
        return $this;
    }
612789
public function addCondition(Condition $condition): Condition
    {
        $query = $this->connection->createQueryBuilder()
            ->insert('ngbm_rule_condition')
            ->values(
                [
                    'id' => ':id',
                    'status' => ':status',
                    'rule_id' => ':rule_id',
                    'type' => ':type',
                    'value' => ':value',
                ]
            )
            ->setValue(
                'id',
                $condition->id !== null ?
                    (int) $condition->id :
                    $this->connectionHelper->getAutoIncrementValue('ngbm_rule_condition')
            )
            ->setParameter('status', $condition->status, Type::INTEGER)
            ->setParameter('rule_id', $condition->ruleId, Type::INTEGER)
            ->setParameter('type', $condition->type, Type::STRING)
            ->setParameter('value', json_encode($condition->value), Type::STRING);

        $query->execute();

        $condition->id = $condition->id ?? (int) $this->connectionHelper->lastInsertId('ngbm_rule_condition');

        return $condition;
    }
282628
protected function resolveConditionalLogic($condition)
    {
        if (is_callable([ $this, $condition ])) {
            return !!$this->{$condition}();
        } elseif (is_callable($condition)) {
            return !!$condition();
        } elseif ($this->view()) {
            return !!$this->renderTemplate($condition);
        }

        return !!$condition;
    }
404598
public function clause($condition = 'AND')
    {
        if (empty($this->where)) {
            $condition = null;
        }
        $clause = new AnDomainQueryClause($this, $condition);

        return $clause;
    }
1139818
protected function _addCondition(array $condition) {
		$conditions = [];
		
		foreach ($condition as $key => $part) {
			if ($key === self::MONGO_OR) {
				if (isset($this->_conditions[self::MONGO_OR]) || isset($this->_conditions[self::MONGO_AND])) {
					// If the "$or" clause already exists, then converts it to the "$and" clause
					if (isset($this->_conditions[self::MONGO_OR])) {
						$mongoAnd = [
							[self::MONGO_OR => $this->_conditions[self::MONGO_OR]],
							[self::MONGO_OR => $part]
						];
						unset($this->_conditions[self::MONGO_OR]);
					}
					// Otherwise, just create the "$and" clause
					else {
						$mongoAnd = [[self::MONGO_OR => $part]];
					}
					
					// If the "$and" clause already exists, then merges it with the last clause
					if (isset($this->_conditions[self::MONGO_AND])) {
						$this->_conditions[self::MONGO_AND] = array_merge(
							$this->_conditions[self::MONGO_AND],
							$mongoAnd
						);
					}
					// Otherwise, put the created clause into the conditions
					else {
						$this->_conditions[self::MONGO_AND] = $mongoAnd;
					}
				} else {
					$conditions[$key] = $part;
				}
			} else {
				$conditions[$key] = $part;
			}
		}
		
		$this->_conditions = $conditions + $this->_conditions;
	}
1284719
public function deserialize(array $condition)
    {
        $this->assertHasKey('name', $condition);
        $this->assertHasKey('key', $condition);
        $this->assertHasKey('operator', $condition);

        if ($condition['name'] !== 'operator-condition') {
            throw new RuntimeException(sprintf('Unable to deserialize operator with name "%s".', $condition['name']));
        }

        $operator = $this->operatorSerializer->deserialize($condition['operator']);

        return new OperatorCondition($condition['key'], $operator);
    }
1222579
public function filter( $condition ) {
		$elements = array();

		foreach ( $this->elements as $element ) {
			if ( call_user_func( $condition, $element ) ) {
				$elements[] = $element;
			}
		}

		return $this->new_from_trusted( $elements );
	}
831752
public function addCondition(Condition\Condition $condition)
    {
        if ($this->qb->queryClass === GetItem::class) {
            throw ODMException::queryGetOperationConditionsNotSupported();
        }

        $this->condition->add($condition);

        return $this;
    }
795126
protected function joinCondition(array $condition): string
	{
		return $this->column($condition['column1']) . ' ' . $condition['operator'] . ' ' . $this->column($condition['column2']);
	}
44494
protected function parseCondition($condition)
    {
        $tableAlias = $this->getAlias();
        $parts = [];

        if ($condition instanceof QueryBuilderAwareInterface) {
            $condition->setQueryBuilder($this);
        }

        if ($condition instanceof Expression) {
            $parts[] = $this->getAdapter()->quoteSql($condition->toSQL());
        } elseif ($condition instanceof Q) {
            $condition->setLookupBuilder($this->getLookupBuilder());
            $condition->setAdapter($this->getAdapter());
            $condition->setTableAlias($tableAlias);
            $parts[] = $condition->toSQL();
        } elseif ($condition instanceof ToSqlInterface) {
            $parts[] = $condition->toSQL();
        } elseif (is_array($condition)) {
            foreach ($condition as $key => $value) {
                if ($value instanceof Q) {
                    $parts[] = $this->parseCondition($value);
                } else {
                    list($lookup, $column, $lookupValue) = $this->lookupBuilder->parseLookup($this, $key, $value);
                    $column = $this->getLookupBuilder()->fetchColumnName($column);
                    if (false === empty($tableAlias) && false === strpos($column, '.')) {
                        $column = $tableAlias.'.'.$column;
                    }
                    $parts[] = $this->lookupBuilder->runLookup($this->getAdapter(), $lookup, $column, $lookupValue);
                }
            }
        } elseif (is_string($condition)) {
            $parts[] = $condition;
        } elseif ($condition instanceof Expression) {
            $parts[] = $condition->toSQL();
        }

        if (1 === count($parts)) {
            return $parts[0];
        }

        return '('.implode(') AND (', $parts).')';
    }
935452
public function addCondition(ConditionAbstract $condition)
    {
        if ($condition instanceof SupportsCondition) {
            $this->conditions[] = $condition;
        } else {
            throw new \InvalidArgumentException(
                "Invalid condition instance. Instance of 'SupportsCondition' expected."
            );
        }

        return $this;
    }
1002477
public function condition($callback = null)
        {
            if ($callback !== null) {
                if (!is_callable($callback)) {
                    throw new InvalidArgumentException(
                        sprintf(
                            "Condition provided is not a valid callback. Given (%s)",
                            gettype($callback)
                        )
                    );
                }

                $this->conditionCallback = $callback;

                return $this;
            }

            return $this->conditionCallback;
        }
677843
protected function resolveConditionalLogic($condition)
    {
        $renderer = $this->getActionRenderer();
        if ($renderer && is_callable([ $renderer, $condition ])) {
            return !!$renderer->{$condition}();
        } elseif (is_callable([ $this, $condition ])) {
            return !!$this->{$condition}();
        } elseif (is_callable($condition)) {
            return !!$condition();
        } elseif ($renderer) {
            return !!$renderer->renderTemplate($condition);
        } elseif ($this->view()) {
            return !!$this->renderTemplate($condition);
        }

        return !!$condition;
    }
663398
public function normalizeCondition($condition)
    {
        if ($condition === true || $condition === 1) {
            return 'true';
        }

        if ($condition === false || $condition === 0) {
            return 'false';
        }

        return Helper::slugify($condition);
    }
168809
private function buildCondition($condition) 
    {
        $where = '';
        
        foreach($condition as $filter) {
            switch(count($filter)) {
                case 1:
                $where .= ' ' . $this->validateLogicalOperator(($filter[0])) . ' ';
                break;
                case 3:
                $where .= $this->quoteColumnName($filter[1]) .' '. $this->validateComparisonOperators($filter[0]) .' '. $this->handleThridParameter($filter[2]);
                break;
                case 4:
                $where .= $this->quoteColumnName($filter[1]) .' '. $this->validateComparisonOperators($filter[0]) .' '. $this->quoteValue($filter[2]) . ' AND ' . $this->quoteValue($filter[3]);
                break;
            }
        }
        
        return $where;
    }
763147
public static function create($condition): self
    {
        $condition = $condition instanceof Condition ? $condition : Condition::fromValue($condition);

        return new self($condition);
    }