Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chain multiple comparision expressions #6

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

andreigorgan
Copy link
Contributor

Added the possiblity to chain multiple comparision expression in a single Disjunction/Conjunction

@coveralls
Copy link

coveralls commented Feb 4, 2020

Coverage Status

Coverage decreased (-1.0%) to 90.4% when pulling 4ce3dce on webchainro:chain_multiple_comparisions into c022625 on tmilos:master.

{
$this->terms[] = $term;
}

/**
* @return Term[]
* @return Filter[]
*/
public function getTerms()
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assuming changing this from Term[] to Filter[] doesn't break anything, I would suggest renaming this to getFilters().

@@ -13,11 +13,11 @@

class Disjunction extends Filter
{
/** @var Term[] */
/** @var Filter[] */
private $terms = [];
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would rename this to $filters.

private $terms = [];

/**
* @param Term[] $terms
* @param Filter[] $terms
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same goes for this one, I would rename to $filters

*/
public function add(Term $term)
public function add(Filter $term)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same goes for this one, I would rename to $filter

Comment on lines +67 to +82

/**
* @return AttributePath
*/
public function getAttributePath()
{
return $this->attributePath;
}

/**
* @return ValuePath
*/
public function getValuePath()
{
return $this->valuePath;
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's already a pending PR for this one: #7

Comment on lines -130 to 141
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;
}
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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();
}

Comment on lines -155 to 169
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;
}
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link

dbollaer commented Aug 12, 2022

Hello @mdeboer / @tmilos any hope of merging this PR? I am running against this issue. Thank you in advance!

@mdeboer
Copy link

mdeboer commented Aug 12, 2022

@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

@stevebauman
Copy link

Noice, thanks @mdeboer! Appreciate that you've taken the helm of this 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants