AbstractSpecification   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 3
dl 0
loc 40
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A andX() 0 4 1
A orX() 0 4 1
A not() 0 4 1
A getParameters() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace RulerZ\Spec;
6
7
/**
8
 * Base class for specifications. Only provides a few usefull shortcuts.
9
 */
10
abstract class AbstractSpecification implements Specification
11
{
12
    /**
13
     * Create a conjunction with the current specification and another one.
14
     *
15
     * @param Specification $spec The other specification.
16
     */
17
    public function andX(Specification $spec): AndX
18
    {
19
        return new AndX([$this, $spec]);
20
    }
21
22
    /**
23
     * Create a disjunction with the current specification and another one.
24
     *
25
     * @param Specification $spec The other specification.
26
     */
27
    public function orX(Specification $spec): OrX
28
    {
29
        return new OrX([$this, $spec]);
30
    }
31
32
    /**
33
     * Negate the current specification.
34
     *
35
     * @return Not
36
     */
37
    public function not(): Not
38
    {
39
        return new Not($this);
40
    }
41
42
    /**
43
     * {@inheritdoc}
44
     */
45
    public function getParameters(): array
46
    {
47
        return [];
48
    }
49
}
50