Completed
Push — master ( 8f0dec...db4c32 )
by Thibaud
02:33
created

OrSpecification::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 6
Ratio 100 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 6
loc 6
ccs 4
cts 4
cp 1
rs 9.4285
cc 1
eloc 3
nc 1
nop 2
crap 1
1
<?php
2
3
namespace Alchemy\Pipeline\Specification;
4
5
use Alchemy\Pipeline\Specification;
6
use Alchemy\Resource\Resource;
7
8 View Code Duplication
class OrSpecification implements Specification
1 ignored issue
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
9
{
10
    /**
11
     * @var Specification
12
     */
13
    private $lhs;
14
15
    /**
16
     * @var Specification
17
     */
18
    private $rhs;
19
20
    /**
21
     * @param Specification $lhs
22
     * @param Specification $rhs
23
     */
24 20
    public function __construct(Specification $lhs, Specification $rhs)
25
    {
26
27 20
        $this->lhs = $lhs;
28 20
        $this->rhs = $rhs;
29 20
    }
30
31
    /**
32
     * @param \Alchemy\Resource\Resource $resource
33
     * @return bool
34
     */
35 16
    public function isSatisfiedBy(Resource $resource)
36
    {
37 16
        return $this->lhs->isSatisfiedBy($resource) || $this->rhs->isSatisfiedBy($resource);
38
    }
39
}
40