Completed
Push — master ( 8f0dec...db4c32 )
by Thibaud
02:33
created

NotSpecification::__construct()   A

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 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 1
crap 1
1
<?php
2
3
namespace Alchemy\Pipeline\Specification;
4
5
use Alchemy\Pipeline\Specification;
6
use Alchemy\Resource\Resource;
7
8
class NotSpecification implements Specification
9
{
10
    /**
11
     * @var Specification
12
     */
13
    private $negatedSpecification;
14
15 12
    public function __construct(Specification $specificationToNegate)
16
    {
17 12
        $this->negatedSpecification = $specificationToNegate;
18 12
    }
19
20
    /**
21
     * @param \Alchemy\Resource\Resource $resource
22
     * @return bool
23
     */
24 8
    public function isSatisfiedBy(Resource $resource)
25
    {
26 8
        return ! $this->negatedSpecification->isSatisfiedBy($resource);
27
    }
28
}
29