Filter   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 85
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 85
rs 10
c 0
b 0
f 0
wmc 6
lcom 1
cbo 0

9 Methods

Rating   Name   Duplication   Size   Complexity  
A isApplied() 0 4 1
A setApplied() 0 4 1
A isNegated() 0 4 1
A negate() 0 6 1
A getToggleUri() 0 4 1
A setToggleUri() 0 4 1
getField() 0 1 ?
getType() 0 1 ?
jsonSerialize() 0 1 ?
1
<?php
2
3
namespace BenTools\OpenCubes\Component\Filter\Model;
4
5
use Psr\Http\Message\UriInterface;
6
7
abstract class Filter implements \JsonSerializable
8
{
9
    public const SATISFIED_BY_ANY = 'ANY';
10
    public const SATISFIED_BY_ALL = 'ALL';
11
12
    /**
13
     * @var bool
14
     */
15
    private $applied = true;
16
17
    /**
18
     * @var bool
19
     */
20
    private $negated = false;
21
22
    /**
23
     * @var UriInterface
24
     */
25
    private $toggleUri;
26
27
    /**
28
     * @return bool
29
     */
30
    public function isApplied(): bool
31
    {
32
        return $this->applied;
33
    }
34
35
    /**
36
     * @param bool $applied
37
     */
38
    public function setApplied(bool $applied): void
39
    {
40
        $this->applied = $applied;
41
    }
42
43
    /**
44
     * @return bool
45
     */
46
    public function isNegated(): bool
47
    {
48
        return $this->negated;
49
    }
50
51
    /**
52
     * @return Filter
53
     */
54
    public function negate(): Filter
55
    {
56
        $clone = clone $this;
57
        $clone->negated = !$this->negated;
58
        return $clone;
59
    }
60
61
    /**
62
     * @return UriInterface
63
     */
64
    public function getToggleUri(): ?UriInterface
65
    {
66
        return $this->toggleUri;
67
    }
68
69
    /**
70
     * @param UriInterface $toggleUri
71
     */
72
    public function setToggleUri(UriInterface $toggleUri): void
73
    {
74
        $this->toggleUri = $toggleUri;
75
    }
76
77
    /**
78
     * @return string
79
     */
80
    abstract public function getField(): string;
81
82
    /**
83
     * @return string
84
     */
85
    abstract public function getType(): string;
86
87
    /**
88
     * @inheritDoc
89
     */
90
    abstract public function jsonSerialize(): array;
91
}
92