Not   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 2
dl 0
loc 33
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A isSatisfiedBy() 0 4 1
A getWrappedSpecification() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace GBProd\Specification;
6
7
/**
8
 * Not specification implementation
9
 *
10
 * @author gbprod <[email protected]>
11
 */
12
final class Not extends CompositeSpecification
13
{
14
    /**
15
     * @var Specification
16
     */
17
    private $wrappedSpecification;
18
19
    /**
20
     * @param Specification $specification
21
     */
22 5
    public function __construct(Specification $specification)
23
    {
24 5
        $this->wrappedSpecification = $specification;
25 5
    }
26
27
    /**
28
     * {inheritdoc}
29
     */
30 3
    public function isSatisfiedBy($candidate): bool
31
    {
32 3
        return !$this->wrappedSpecification->isSatisfiedBy($candidate);
33
    }
34
35
    /**
36
     * Get the wrapped specification
37
     *
38
     * @return Specification
39
     */
40 1
    public function getWrappedSpecification(): Specification
41
    {
42 1
        return $this->wrappedSpecification;
43
    }
44
}
45