Not::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
crap 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