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