Passed
Push — master ( c1e0d4...ba393a )
by La Teva Web
04:30
created

AbstractFilter   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 53
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 12
dl 0
loc 53
ccs 17
cts 17
cp 1
rs 10
c 0
b 0
f 0
wmc 6

6 Methods

Rating   Name   Duplication   Size   Complexity  
A field() 0 3 1
A getName() 0 3 1
A getStoredValue() 0 3 1
A setStoredValue() 0 3 1
A __construct() 0 5 1
A setName() 0 3 1
1
<?php
2
3
namespace LaTevaWeb\QueryUpdater\Filter;
4
5
abstract class AbstractFilter
6
{
7
    protected $name;
8
    protected $value;
9
    protected $storedValue;
10
11 4
    private function __construct(string $name, $value = null, $storedValue = null)
12
    {
13 4
        $this->setName($name);
14 4
        $this->setValue($value);
15 4
        $this->setStoredValue($storedValue);
16 4
    }
17
18 4
    public static function field(string $name, $value = null, $storedValue = null): self
19
    {
20 4
        return new static($name, $value, $storedValue);
21
    }
22
23
    /**
24
     * @return string
25
     */
26 4
    public function getName(): string
27
    {
28 4
        return $this->name;
29
    }
30
31
    /**
32
     * @param string $name
33
     */
34 4
    public function setName(string $name): void
35
    {
36 4
        $this->name = $name;
37 4
    }
38
39
    /**
40
     * @return mixed
41
     */
42 1
    public function getStoredValue()
43
    {
44 1
        return $this->storedValue;
45
    }
46
47
    /**
48
     * @param mixed $storedValue
49
     */
50 4
    public function setStoredValue($storedValue): void
51
    {
52 4
        $this->storedValue = $storedValue;
53 4
    }
54
55
    abstract public function getValue();
56
57
    abstract public function setValue($value = null): void;
58
}
59