BinarySpecification::leftIsSatisfiedBy()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types = 1);
4
5
namespace Stratadox\Specification\Binary;
6
7
use Stratadox\Specification\Specifying;
8
use Stratadox\Specification\Contract\Satisfiable;
9
use Stratadox\Specification\Contract\Specifies;
10
11
abstract class BinarySpecification implements Specifies
12
{
13
    use Specifying;
14
15
    private $leftHandCondition;
16
    private $rightHandCondition;
17
18
    public function __construct(
19
        Satisfiable $leftHandCondition,
20
        Satisfiable $rightHandCondition
21
    ) {
22
        $this->leftHandCondition = $leftHandCondition;
23
        $this->rightHandCondition = $rightHandCondition;
24
    }
25
26
    public function leftHandCondition() : Satisfiable
27
    {
28
        return $this->leftHandCondition;
29
    }
30
31
    public function rightHandCondition() : Satisfiable
32
    {
33
        return $this->rightHandCondition;
34
    }
35
36
    protected function leftIsSatisfiedBy($object) : bool
37
    {
38
        return $this->leftHandCondition->isSatisfiedBy($object);
39
    }
40
41
    protected function rightIsSatisfiedBy($object) : bool
42
    {
43
        return $this->rightHandCondition->isSatisfiedBy($object);
44
    }
45
}
46