AndSpecification::isSatisfiedBy()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
nc 2
nop 1
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
declare(strict_types=1);
3
4
namespace Anfischer\Specification;
5
6
class AndSpecification extends Specification
7
{
8
    /**
9
     * @var Specification
10
     */
11
    private $left;
12
13
    /**
14
     * @var Specification
15
     */
16
    private $right;
17
18
    /**
19
     * @param Specification $left
20
     * @param Specification $right
21
     */
22 2
    public function __construct(Specification $left, Specification $right)
23
    {
24 2
        $this->left   = $left;
25 2
        $this->right = $right;
26 2
    }
27
28
    /**
29
     * @param mixed $object
30
     * @return bool
31
     */
32 2
    public function isSatisfiedBy($object): bool
33
    {
34 2
        return $this->left->isSatisfiedBy($object) && $this->right->isSatisfiedBy($object);
35
    }
36
}
37