Not::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 1
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace RulerZ\Spec;
6
7
/**
8
 * Negates a specification.
9
 */
10
class Not extends AbstractSpecification
11
{
12
    /**
13
     * @var Specification
14
     */
15
    private $specification;
16
17
    /**
18
     * Constructor.
19
     *
20
     * @param Specification $specification The specification to negate.
21
     */
22
    public function __construct(Specification $specification)
23
    {
24
        $this->specification = $specification;
25
    }
26
27
    /**
28
     * {@inheritdoc}
29
     */
30
    public function getRule(): string
31
    {
32
        return sprintf('NOT (%s)', $this->specification->getRule());
33
    }
34
35
    /**
36
     * {@inheritdoc}
37
     */
38
    public function getParameters(): array
39
    {
40
        return $this->specification->getParameters();
41
    }
42
}
43