Chain multiple comparision expressions#6
Conversation
Add getters for Path attributes
…tiple_or_conditions Fix scim filtering to allow multiple or conditions
…unction or a disjunction
| * @return Term[] | ||
| * @return Filter[] | ||
| */ | ||
| public function getTerms() |
There was a problem hiding this comment.
Assuming changing this from Term[] to Filter[] doesn't break anything, I would suggest renaming this to getFilters().
| { | ||
| /** @var Term[] */ | ||
| /** @var Filter[] */ | ||
| private $terms = []; |
|
|
||
| /** | ||
| * @param Term[] $terms | ||
| * @param Filter[] $terms |
There was a problem hiding this comment.
Same goes for this one, I would rename to $filters
| * @param Filter $term | ||
| */ | ||
| public function add(Term $term) | ||
| public function add(Filter $term) |
There was a problem hiding this comment.
Same goes for this one, I would rename to $filter
|
|
||
| /** | ||
| * @return AttributePath | ||
| */ | ||
| public function getAttributePath() | ||
| { | ||
| return $this->attributePath; | ||
| } | ||
|
|
||
| /** | ||
| * @return ValuePath | ||
| */ | ||
| public function getValuePath() | ||
| { | ||
| return $this->valuePath; | ||
| } |
There was a problem hiding this comment.
There's already a pending PR for this one: #7
|
|
||
| if ($this->lexer->isNextToken(Tokens::T_SP)) { | ||
| $isNextTokenOr = true; | ||
| while($this->lexer->isNextToken(Tokens::T_SP) && $isNextTokenOr) { | ||
| $nextToken = $this->lexer->glimpse(); | ||
| if ($this->isName('or', $nextToken)) { | ||
| $this->match(Tokens::T_SP); | ||
| $this->match(Tokens::T_NAME); | ||
| $this->match(Tokens::T_SP); | ||
| $terms[] = $this->conjunction(); | ||
| } else { | ||
| $isNextTokenOr = false; | ||
| } | ||
| } |
There was a problem hiding this comment.
Instead of using a variable to break the while loop, simply use the break statement instead.
while ($this->lexer->isNextToken(Tokens::T_SP)) {
$nextToken = $this->lexer->glimpse();
if ($this->isName('or', $nextToken) === false) {
break;
}
$this->match(Tokens::T_SP);
$this->match(Tokens::T_NAME);
$this->match(Tokens::T_SP);
$terms[] = $this->conjunction();
}|
|
||
| if ($this->lexer->isNextToken(Tokens::T_SP)) { | ||
| $isNextTokenAnd = true; | ||
| while($this->lexer->isNextToken(Tokens::T_SP) && $isNextTokenAnd) { | ||
| $nextToken = $this->lexer->glimpse(); | ||
| if ($this->isName('and', $nextToken)) { | ||
| $this->match(Tokens::T_SP); | ||
| $this->match(Tokens::T_NAME); | ||
| $this->match(Tokens::T_SP); | ||
| $factors[] = $this->factor(); | ||
| } else { | ||
| $isNextTokenAnd = false; | ||
| } | ||
| } |
There was a problem hiding this comment.
Same goes for this one:
while ($this->lexer->isNextToken(Tokens::T_SP)) {
$nextToken = $this->lexer->glimpse();
if ($this->isName('and', $nextToken) === false) {
break;
}
$this->match(Tokens::T_SP);
$this->match(Tokens::T_NAME);
$this->match(Tokens::T_SP);
$factors[] = $this->factor();
}|
@dbollaer Well this repository isn't mine so don't ask me haha. Given the last release was in 2017, I doubt it though. Shameless plug but you could try mine if you like: https://github.com/Cloudstek/scim-filter-parser |
|
Noice, thanks @mdeboer! Appreciate that you've taken the helm of this 🙏 |
Added the possiblity to chain multiple comparision expression in a single Disjunction/Conjunction