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

Composite must be extends AbstractSpecification #120

Open
cedvan opened this issue Jan 21, 2021 · 0 comments
Open

Composite must be extends AbstractSpecification #120

cedvan opened this issue Jan 21, 2021 · 0 comments

Comments

@cedvan
Copy link

cedvan commented Jan 21, 2021

Hi,

Composite must be extends AbstractSpecification to chain multiple specifications.

Sample :

class specificationA extends AbstractSpecification 
{
    ...
}

class specificationB extends AbstractSpecification 
{
    ...
}

class specificationC extends AbstractSpecification 
{
    ...
}

$specificationA
    ->andX($specificationB)
    ->andX($specificationC);

Keep chain support to specification type composite

class specificationD extends AndX
{
    public function __construct()
    {
        parent::__construct([
            new specificationA(),
            new specificationB(),
            new specificationC()
        ]);
    }
}

class specificationE extends Composite
{
    public function __construct()
    {
        parent::__construct(
            "MyOperator",
            [
                new specificationA(),
                new specificationB(),
                new specificationC()
            ]
        );
    }
}

$specificationD->andX($specificationE)->andX(...)
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

No branches or pull requests

1 participant