@param Condition|null $condition

@return \Closure|null
171794
public function sort(Condition $condition = null)
    {
        if ($condition) {
            $sort = $condition->getSort();
            return function (array $item1, array $item2) use ($sort) {
                foreach ($sort as $field => $dir) {
                    $value1 = $item1[$field] ?? null;
                    $value2 = $item2[$field] ?? null;
                    if ($value1 === $value2) {
                        continue;
                    }
                    return ($value1 <=> $value2) * ($dir === \SORT_ASC ? 1 : -1);
                }
                return 0;
            };
        }

        return null;
    }
1252836
public function condition($condition)
    {
        $reference = $this;

        if (count($this->conditions) !== 0) {
            ob_end_clean();
        }

        $reference->saveCondition($condition, ''); /// so above count fires after first pass

        ob_start(function ($data) use ($condition, $reference) {
            $reference->saveCondition($condition, $data);
        });
    }
733615
protected function resolveConditionalLogic($condition)
    {
        if (is_callable([ $this, $condition ])) {
            return !!$this->{$condition}();
        } elseif (is_callable($condition)) {
            return !!$condition();
        } elseif ($this->form()->obj()->view()) {
            return !!$this->form()->obj()->renderTemplate($condition);
        }

        return !!$condition;
    }
726312
public function stopWhen($condition)
    {
        if (!is_callable($condition)) {
            $condition = $this->_createMatcherFilter($condition);
        }

        return new StoppableIterator($this->unwrap(), $condition);
    }
1100758
public function find_last( $condition ) {
		$index = $this->find_last_index( $condition );

		return -1 === $index ? null : $this->elements[ $index ];
	}
423555
public function when($condition, Closure $trueFunc, Closure $falseFunc = null) {
        if ($condition) {
            $trueFunc($this);
            return $this;
        }
        if (!empty($falseFunc)) {
            $falseFunc($this);
        }
        return $this;
    }
469508
protected function compileCondition(ConditionContract $condition)
    {

        $operand = $condition->operand();

        $matcher = $this->compile($condition->constraint());

        return function ($data) use ($operand, $matcher) {
            return $matcher($this->value($data, $operand));
        };

    }
401323
public function when($condition, $query, $otherwise = null)
    {
        if ($condition instanceof \Closure) {
            $condition = $condition($this);
        }

        if ($condition) {
            if ($query instanceof \Closure) {
                $query($this, $condition);
            } elseif (is_array($query)) {
                $this->where($query);
            }
        } elseif ($otherwise) {
            if ($otherwise instanceof \Closure) {
                $otherwise($this, $condition);
            } elseif (is_array($otherwise)) {
                $this->where($otherwise);
            }
        }

        return $this;
    }
1184923
public function delete($condition)
    {
        $result = null;
        $this->hook->attach('product.class.field.delete.before', $condition, $result, $this);

        if (isset($result)) {
            return (bool) $result;
        }

        if (!is_array($condition)) {
            $condition = array('product_class_field_id' => $condition);
        }

        $result = (bool) $this->db->delete('product_class_field', $condition);
        $this->hook->attach('product.class.field.delete.after', $condition, $result, $this);
        return (bool) $result;
    }
1331123
public function parse(ActivationInterface $condition)
    {
        $rootNode = null;
        $this->resetParser($condition);

        if (false === $condition instanceof EmptyActivation) {
            try {
                $rootNode = $this->getNodeRecursive();
            } catch (ConditionParserException $exception) {
                $error = new Error($exception->getMessage(), $exception->getCode());
                $this->result->addError($error);
            }
        }

        $rootNode = $rootNode ?: NullNode::get();

        /** @var ConditionTree $tree */
        $tree = GeneralUtility::makeInstance(ConditionTree::class, $rootNode, $this->result);

        return $tree;
    }
715488
public function orWhereRaw(string $condition): self
    {
        $this->condition->orWhere([new RawExp($condition)]);

        return $this;
    }
911251
private function cleanCondition($condition)
    {
        if (is_array($condition)) {
            $condition = array_filter($condition);
            if (empty($condition)) {
                $condition = null;
            }
        }

        return $condition;
    }
629547
public function where($conditions): self
    {
        if ($conditions[0] instanceof Closure) {
            $this->addClauseCondClosure('where', 'AND', $conditions[0]);

            return $this;
        }
        $this->where[] = ['and', $conditions];

        return $this;
    }
991887
public function filterOne(array $condition)
	{
		$cond = [];
		foreach ($condition as $key => $value) {
			$cond[$this->prepareColumn($key)] = $value;
		}
		$this->data_source = $this->data_source->findBy($cond);

		return $this;
	}
697907
public function filter(\Closure $condition): Collection
	{
		$collection = new self($this->validator);
		foreach ((array) $this as $offset => $value)
			if ($condition($value))
				$collection->offsetSet($offset, $value);

		return $collection;
	}
663661
public function add($parameters, $condition = null)
    {
        if (is_array($parameters)) {
            foreach ($parameters as $parameter => $condition) {
                $this->add($parameter, $condition);
            }

            return;
        }

        return $this->register($parameters, $condition);
    }
993721
public static function basedOn($condition): self
    {
        $name = $condition instanceof Condition ? $condition->name() : $condition;

        return new self($name, '');
    }