Filter one row
@param  array $condition
@return mixed
357387
public function filterRow(array $condition)
	{
		$this->onBeforeFilter($this->data_source);
		$this->onAfterFilter($this->data_source);

		return $this->data_source->filterOne($condition)->getData();
	}
598140
public function fetchRow($condition = array())
    {
        $query = self::getInstance($this, $condition);

        return $this->getRepository()->fetch($query, AnDomain::FETCH_ROW);
    }
811522
public function setCondition(array $condition)
    {
        if (!isset($condition['function'])) {
            return false;
        }

        $this->conditional_function = $condition['function'];

        if (isset($condition['parameters'])) {
            $this->conditional_parameters = (array) $condition['parameters'];
        }

        if (isset($condition['inverse'])) {
            $this->conditional_inverse = (boolean) $condition['inverse'];
        }
    }
281730
public function drop_while( $condition ) {
		$count = $this->count_while_true( $condition );
		return $count ? $this->drop( $count ) : $this;
	}
89890
public function filter(Condition $condition = null, int &$limit = null, int &$offset = null)
    {
        $offset = (int)$offset;

        if ($condition) {
            $limit = $condition->getLimit();
            $offset = (int)$condition->getOffset();
            $conditions = $condition->getConditions();
            return function (array $item) use ($conditions) {
                foreach ($conditions as $cond) {
                    if (!\is_array($cond)) {
                        continue;
                    }

                    $cond = \array_values($cond);
                    $type = \array_shift($cond);
                    $value = $item[$cond[0]] ?? null;
                    switch ($type) {
                        case Condition::EQUALS:
                            if (\is_array($value)) {
                                if (!\in_array($cond[1], $value, false)) {
                                    return false;
                                }
                            } else {
                                /** @noinspection TypeUnsafeComparisonInspection */
                                if ($value != $cond[1]) {
                                    return false;
                                }
                            }
                            break;
                        case Condition::NOT_EQUALS:
                            /** @noinspection TypeUnsafeComparisonInspection */
                            if ($value == $cond[1]) {
                                return false;
                            }
                            break;
                        case Condition::LESS_THAN:
                            if ($value >= $cond[1]) {
                                return false;
                            }
                            break;
                        case Condition::GREATER_THAN:
                            if ($value <= $cond[1]) {
                                return false;
                            }
                            break;
                        case Condition::LESS_OR_EQUALS:
                            if ($value > $cond[1]) {
                                return false;
                            }
                            break;
                        case Condition::GREATER_OR_EQUALS:
                            if ($value < $cond[1]) {
                                return false;
                            }
                            break;
                        case Condition::BETWEEN:
                            if ($value < $cond[1] || $value > $cond[2]) {
                                return false;
                            }
                            break;
                        case Condition::LIKE:
                            if (!\mb_strstr($value, $cond[1])) {
                                return false;
                            }
                            break;
                        case Condition::IN:
                            if (!\in_array($value, $cond[1], false)) {
                                return false;
                            }
                            break;
                    }
                }

                return true;
            };
        }

        return null;
    }
430535
protected function filterBlocks(string $condition, array $blocks)
    {
        if (empty($condition)) {
            return $blocks;
        }

        $conditions = [];
        foreach (explode(';', $condition) as $condition) {
            if (strpos($condition, ':') === false) {
                //Invalid
                continue;
            }

            list($name, $value) = explode(":", $condition);
            $conditions[$name] = $value;
        }

        $result = $blocks;
        if (isset($conditions['prefix'])) {
            $result = [];
            foreach ($blocks as $name => $value) {
                if (strpos($name, $conditions['prefix']) === 0) {
                    //Prefix plus "-" sign
                    $result[substr($name, strlen($conditions['prefix']) + 1)] = $value;
                }
            }
        }

        if (isset($conditions['include'])) {
            $include = explode(',', $conditions['include']);

            foreach ($blocks as $name => $value) {
                if (!in_array($name, $include)) {
                    unset($result[$name]);
                }
            }
        }

        if (isset($conditions['exclude'])) {
            $exclude = explode(',', $conditions['exclude']);

            foreach ($blocks as $name => $value) {
                if (in_array($name, $exclude)) {
                    unset($result[$name]);
                }

                foreach ($exclude as $pattern) {
                    if (strpos($pattern, '*') === false) {
                        //Not pattern
                        continue;
                    }

                    $pattern = '/^' . str_replace('*', '.+', $pattern) . '/i';

                    if (preg_match($pattern, $name)) {
                        unset($result[$name]);
                    }
                }
            }
        }

        return $result;
    }
232348
public function where($condition) 
    {       
        $this->condition = $condition;
        $this->sql .= ' WHERE ' . $this->buildCondition($condition);
        
        return $this;
    }
613835
public function path(array $condition)
    {
        if (!in_array($condition['operator'], array('=', '!='))) {
            return false;
        }

        $path = $this->url->path();

        $found = false;

        foreach ((array) $condition['value'] as $pattern) {
            if (gplcart_path_match($path, $pattern)) {
                $found = true;
            }
        }

        return $condition['operator'] === '=' ? $found : !$found;
    }
1278161
public function used(array $condition, array $data)
    {
        if (!isset($data['rule']['used'])) {
            return false;
        }

        return $this->compare($data['rule']['used'], $condition['value'], $condition['operator']);
    }
595859
public function finds($condition = NULL, $rows = 0, $start = 0, $order='', $fields = '*', $fetchMode=PDO::FETCH_ASSOC) {
		if (is_array($condition)) {
			$where = $condition[0];
			$params = $condition[1];
		} 
		else {
			$where = $condition;
			$params = null;
		}
		return $this->driver
            ->field($fields)
            ->where($where, $params)
            ->orderby($order)
            ->limit($rows, $start)
            ->fetchAll($fetchMode);
	}
186256
protected function makeWhere(Condition $condition, array $data = NULL)
    {
        $data = $data === NULL
            ? $this->data
            : $data;

        return array_filter($data, function ($row) use ($condition) {
            if ($condition->callback) {
                return call_user_func_array($condition->callback, [$condition->value, $row]);
            }

            $i = 0;
            $results = [];
            foreach ($condition->column as $column) {
                if (Condition::isOperator($column)) {
                    $results[] = " $column ";

                } else {
                    $i = count($condition->condition) > 1 ? $i : 0;
                    $results[] = (int) $this->compare(
                        $row[$column],
                        $condition->condition[$i],
                        isset($condition->value[$i]) ? $condition->value[$i] : NULL
                    );

                    $i++;
                }
            }

            $result = implode('', $results);
            return count($condition->column) === 1
                ? (bool) $result
                : eval("return $result;"); // QUESTION: How to remove this eval? hmmm?
        });
    }
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);
    }
902486
public function filterOne(array $condition)
	{
		$p = $this->getPlaceholder();

		foreach ($condition as $column => $value) {
			$c = $this->checkAliases($column);

			$this->data_source->andWhere("$c = :$p")
				->setParameter($p, $value);
		}

		return $this;
	}
561945
public function removeCondition($condition)
    {
        if ($this->conditions->contains($condition)) {
            $this->conditions->removeElement($condition);
        }

        return $this;
    }
717930
private function getFilteredRow($row)
    {
        $newRow = array();

        foreach ($row as $column => $value) {
            if (in_array($column, $this->columns)) {
                $newRow[$column] = $value;
            }
        }

        return $newRow;
    }
82604
public function process(array $row)
    {
        foreach ($row as &$item) {
            if (is_bool($item)) {
                $item = $item ? 1 : 0;
            }
        }

        return $row;
    }
498058
public function all($condition)
    {
        return ! $this->any(
            // TODO: create Not predicate class
            function ($elem, $idx) use ($condition) {
                return ! $condition($elem, $idx);
            }
        );
    }