@internal

@param $conditions

@return string
764739
private function topicsForFcm($conditions)
    {
        $condition = '';
        foreach ($conditions as $partial) {
            if (array_key_exists('condition', $partial)) {
                $condition .= $partial['condition'];
            }

            if (array_key_exists('first', $partial)) {
                $topic = $partial['first'];
                $condition .= "'$topic' in topics";
            }

            if (array_key_exists('open_parenthesis', $partial)) {
                $condition .= $partial['open_parenthesis'];
            }

            if (array_key_exists('topic', $partial)) {
                $condition .= $this->topicsForFcm($partial['topic']);
            }

            if (array_key_exists('close_parenthesis', $partial)) {
                $condition .= $partial['close_parenthesis'];
            }
        }

        return $condition;
    }
265071
protected function regexUrl($matches)
    {
        $key = substr($matches[0], 1);
        if (isset($this->conditions[$key])) {
            return '(' . $this->conditions[$key] . ')';
        } else {
            return '(' . self::$conditionRegex['default'] . ')';
        }
    }
795126
protected function joinCondition(array $condition): string
	{
		return $this->column($condition['column1']) . ' ' . $condition['operator'] . ' ' . $this->column($condition['column2']);
	}
979522
public static function arrWhere(Array $conditions)
    {

        $model = static::class;
        $obj = new $model();

        foreach ($conditions as $condition) {
            if (count($condition) == 2) {
                $obj = $obj->where($condition[0], $condition[1]);
            } elseif (count($condition) == 3) {
                if (strtolower(trim($condition[1])) === 'between') {
                    $obj = $obj->whereBetween($condition[0], $condition[2]);
                } else {
                    $obj = $obj->where($condition[0], $condition[1], $condition[2]);
                }
            } elseif (count($condition) == 4) {
                if (strtolower(trim($condition[1])) === 'between') {
                    $obj = $obj->whereBetween($condition[0], $condition[2], $condition[3]);
                } else {
                    $obj = $obj->where($condition[0], $condition[1], $condition[2], $condition[3]);
                }
            } else {
                throw new \Exception("Invalid " . strtoupper($key) . " condition", 1);
            }
        }

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

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

        return Helper::slugify($condition);
    }
1250094
public function orHaving(...$conditions) : self
    {
        $this->havingConditions = $this->conditionalQueryBuilder->addConditionToClause(
            $this->havingConditions, 'OR', ...$this->createConditionExpressions($conditions)
        );

        return $this;
    }
1139385
public function deleteBy($conditions = [])
    {
        if (count($conditions)) {
            if (method_exists($this, 'beforeDelete')) {
                $this->beforeDelete();
            }

            if (method_exists($this, 'beforeDelete')) {
                $this->beforeDelete();
            }

            if ($this->qb->table($this->table)->limit(1)->delete($conditions)) {
                if (method_exists($this, 'afterDelete')) {
                    return $this->afterDelete();
                }

                return $this->db->getAffectedRows();
            }
        }

        return false;
    }
1204786
public function findOneBy(array $conditions)
    {
        $s = $this->selector()->one();
        foreach ($conditions as $column => $value) {
            $s->where($column, '=', $value);
        }

        return $s->execute();
    }
42444
protected function compileConditions(array $conditions, $conjunction = null)
    {
        if (count($conditions) === 1) {
            return $conditions[0];
        }

        if ($conjunction === null) {
            $conjunction = $this->conjunction();
        }

        return '('.implode(' '.$conjunction.' ', $conditions).')';
    }
1076301
protected function whereConditions(array $wheres): string
	{
		$conditions = [];

		$conditionCounter = 0;

		foreach($wheres as $where)
		{
			$conditions[] = ($conditionCounter > 0 ? $where['separator'] . ' ' : null) . $this->{$where['type']}($where);

			$conditionCounter++;
		}

		return implode(' ', $conditions);
	}
1140484
protected function makeConditions(array $conditions): ?\SplObjectStorage
    {
        if (empty($conditions)) {
            return null;
        }

        $storage = new \SplObjectStorage();
        foreach ($conditions as $condition => $options) {
            $condition = $this->config->resolveAlias($condition);

            if ($this->config->hasCondition($condition)) {
                $autowire = $this->config->getCondition($condition);
            } else {
                $autowire = new Autowire($condition);
            }

            $storage->attach($autowire->resolve($this->factory), $options);
        }

        return $storage;
    }
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;
    }
1202478
public function first(callable $conditions = null)
    {
        $array = $this->convertArray($this);

        if ($conditions) {
            foreach ($array as $key => $value) {
                if ($conditions($value, $key)) {
                    return $value;
                }
            }

            return null;
        }

        return $array[array_key_first($array)];
    }
1202319
public function findAllBy(array $conditions = array())
    {
        $sql = sprintf('SELECT * FROM %s', $this->getTableName());
        $whereConditions = $this->assembleEquality($conditions);
        $where = sprintf('WHERE %s', implode(' AND ', $whereConditions));
        $sql .= " $where";

        return $this->selectQuery($sql, $conditions);
    }
914345
public function findOne($conditions, $params = array()){
        $row = $this->db->builder()->select()->from($this->table)->where($conditions, $params)->limit(1)->queryRow();
        if(false === $row){
            return false;
        }
        
        return $this->map($row);
    }
133206
protected function parseCondition(string $condition): string
    {
        $conditions = $this->getConditions();

        foreach ($conditions as $signature => $conds) {
            $conds = is_array($conds) ? $conds : [$conds];

            if (in_array($condition, $conds, true)) {
                return $signature;
            }
        }

        return '';
    }
502827
public function setConditions($conditions)
    {
        $this->conditions = [];
        if (!is_array($conditions)) {
            $conditions = [$conditions];
        }
        foreach ($conditions as $condition) {
            $this->addCondition($condition);
        }

        return $this;
    }