Skip to content
Snippets Groups Projects
Commit 75b0aa4f authored by Sebastien ANDRE's avatar Sebastien ANDRE
Browse files

remove dead code on criteria and refacto

parent 471d1fa9
Branches
1 merge request!67[RTOK] remove dead code on criteria and refacto
Pipeline #32814 passed with stage
in 51 seconds
......@@ -179,29 +179,17 @@ class Storm_Query_Criteria implements Storm_Query_CriteriaInterface {
}
protected function _containsAllAttributesForAnd(array $model) : bool {
return null === (new Storm_Collection($this->_clauses))
->reject(fn($clause) => $clause instanceof Storm_Query_Sub)
->detect(fn($clause) => ! $this->_containsOne($clause, $model));
foreach ($this->_clauses as $clause)
if ( ! $this->_containsOne($clause, $model))
return false;
return true;
protected function _containsAllAttributesForAnd(array $model): bool
{
return null === $this->_clausesWithoutSub()
->detect(fn($clause) => ! $this->_containsOne($clause, $model));
}
protected function _containsAllAttributesForOr(array $model) : bool {
return null !== (new Storm_Collection($this->_clauses))
->reject(fn($clause) => $clause instanceof Storm_Query_Sub)
->detect(fn($clause) => $this->_containsOne($clause, $model));
foreach ($this->_clauses as $clause)
if ($this->_containsOne($clause, $model))
return true;
return false;
protected function _containsAllAttributesForOr(array $model): bool
{
return null !== $this->_clausesWithoutSub()
->detect(fn($clause) => $this->_containsOne($clause, $model));
}
......@@ -213,6 +201,13 @@ class Storm_Query_Criteria implements Storm_Query_CriteriaInterface {
}
protected function _clausesWithoutSub(): Storm_Collection
{
return (new Storm_Collection($this->_clauses))
->reject(fn($clause) => $clause instanceof Storm_Query_Sub);
}
/**
* @param $key string | Storm_Query_Key
* @param $value int | string
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment