Passed
Push — main ( 8fe4a9...23f062 )
by Stefan
03:16
created

AbstractFormData   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 61
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 10
c 1
b 0
f 0
dl 0
loc 61
rs 10
wmc 6

6 Methods

Rating   Name   Duplication   Size   Complexity  
A getSelectOptions() 0 3 1
A setBtnValue() 0 3 1
A setSelectOptions() 0 3 1
A getBtnValue() 0 3 1
A getValue() 0 3 1
A setValue() 0 3 1
1
<?php
2
namespace SKien\Formgenerator;
3
4
/**
5
 *
6
 * @author sk
7
 *        
8
 */
9
abstract class AbstractFormData implements FormDataInterface
10
{
11
    protected array $aValues;
12
    protected array $aSelectOptions;
13
    protected array $aBtnValues;
14
    
15
    /**
16
     * (non-PHPdoc)
17
     * @see \SKien\Formgenerator\FormDataInterface::getValue()
18
     */
19
    public function getValue(string $strName)
20
    {
21
        return $this->aValues[$strName] ?? '';
22
    }
23
24
    /**
25
     * (non-PHPdoc)
26
     * @see \SKien\Formgenerator\FormDataInterface::getSelectOptions()
27
     */
28
    public function getSelectOptions(string $strName) : array
29
    {
30
        return $this->aSelectOptions[$strName] ?? [];
31
    }
32
    
33
    /**
34
     * (non-PHPdoc)
35
     * @see \SKien\Formgenerator\FormDataInterface::getSelectOptions()
36
     */
37
    public function getBtnValue(string $strName) : string
38
    {
39
        return $this->aBtnValues[$strName] ?? '';
40
    }
41
    
42
    /**
43
     * Set value for specified element.
44
     * @param string $strName
45
     * @param mixed $value
46
     */
47
    public function setValue(string $strName, $value) : void
48
    {
49
        $this->aValues[$strName] = $value;
50
    }
51
    
52
    /**
53
     * Set selectiptions for specified elemnt
54
     * @param string $strName
55
     * @param array $aOptions
56
     */
57
    public function setSelectOptions(string $strName, array $aOptions) : void
58
    {
59
        $this->aSelectOptions[$strName] = $aOptions;
60
    }
61
    
62
    /**
63
     * Set value for specified element.
64
     * @param string $strName
65
     * @param mixed $value
66
     */
67
    public function setBtnValue(string $strName, $value) : void
68
    {
69
        $this->aBtnValues[$strName] = $value;
70
    }
71
}
72
73