UnarySpecification   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 19
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A conditionIsSatisfiedBy() 0 3 1
A __construct() 0 3 1
A condition() 0 3 1
1
<?php
2
3
declare(strict_types = 1);
4
5
namespace Stratadox\Specification\Unary;
6
7
use Stratadox\Specification\Specifying;
8
use Stratadox\Specification\Contract\Satisfiable;
9
use Stratadox\Specification\Contract\Specifies;
10
11
abstract class UnarySpecification implements Specifies
12
{
13
    use Specifying;
14
15
    private $condition;
16
17
    public function __construct(Satisfiable $condition)
18
    {
19
        $this->condition = $condition;
20
    }
21
22
    protected function conditionIsSatisfiedBy($object) : bool
23
    {
24
        return $this->condition->isSatisfiedBy($object);
25
    }
26
27
    public function condition() : Satisfiable
28
    {
29
        return $this->condition;
30
    }
31
}
32