AFilterEntry::setKey()   A
last analyzed

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 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 4
rs 10
c 0
b 0
f 0
ccs 3
cts 3
cp 1
crap 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