AFilterEntry   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 10
dl 0
loc 30
rs 10
c 0
b 0
f 0
ccs 10
cts 10
cp 1
wmc 5

4 Methods

Rating   Name   Duplication   Size   Complexity  
A setRelation() 0 4 2
A getKey() 0 3 1
A setKey() 0 4 1
A getRelation() 0 3 1
1
<?php
2
3
namespace kalanis\kw_filter;
4
5
6
/**
7
 * Class AFilterEntry
8
 * @package kalanis\kw_filter
9
 * Abstraction class for filter entries
10
 */
11
abstract class AFilterEntry implements Interfaces\IFilterEntry
12
{
13
    /** @var string[] */
14
    protected static $relations = [];
15
16
    /** @var string */
17
    protected $key = '';
18
    /** @var string */
19
    protected $relation = self::RELATION_EQUAL;
20
21 6
    public function setKey(string $key): Interfaces\IFilterEntry
22
    {
23 6
        $this->key = $key;
24 6
        return $this;
25
    }
26
27 7
    public function getKey(): string
28
    {
29 7
        return $this->key;
30
    }
31
32 9
    public function setRelation(string $relation): Interfaces\IFilterEntry
33
    {
34 9
        $this->relation = in_array($relation, static::$relations) ? $relation : $this->relation;
35 9
        return $this;
36
    }
37
38 8
    public function getRelation(): string
39
    {
40 8
        return $this->relation;
41
    }
42
}
43