Completed
Push — master ( 5163d9...817b84 )
by Mike
07:06 queued 11s
created

NotSpecification   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A isSatisfiedBy() 0 4 1
A canBeSatisfiedBySomethingBelow() 0 4 1
A willBeSatisfiedByEverythingBelow() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
/**
6
 * This file is part of phpDocumentor.
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 *
11
 * @link      http://phpdoc.org
12
 */
13
14
namespace Flyfinder\Specification;
15
16
/**
17
 * Class NotSpecification
18
 *
19
 * @psalm-immutable
20
 */
21
final class NotSpecification extends CompositeSpecification
22
{
23
    /** @var SpecificationInterface */
24
    private $wrapped;
25
26
    /**
27
     * Initializes the NotSpecification object
28
     */
29
    public function __construct(SpecificationInterface $wrapped)
30 2
    {
31
        $this->wrapped = $wrapped;
32 2
    }
33 2
34
    /**
35
     * {@inheritDoc}
36
     */
37
    public function isSatisfiedBy(array $value) : bool
38
    {
39
        return !$this->wrapped->isSatisfiedBy($value);
40 2
    }
41
42 2
    /** @inheritDoc */
43
    public function canBeSatisfiedBySomethingBelow(array $value) : bool
44
    {
45
        return !self::thatWillBeSatisfiedByEverythingBelow($this->wrapped, $value);
46
    }
47
48
    /** @inheritDoc */
49
    public function willBeSatisfiedByEverythingBelow(array $value) : bool
50
    {
51
        return !self::thatCanBeSatisfiedBySomethingBelow($this->wrapped, $value);
52
    }
53
}
54