BinarySpecification   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 33
rs 10
c 0
b 0
f 0
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A rightIsSatisfiedBy() 0 3 1
A leftHandCondition() 0 3 1
A leftIsSatisfiedBy() 0 3 1
A __construct() 0 6 1
A rightHandCondition() 0 3 1
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