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

AbstractFormData::getSelectOptions()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 3
rs 10
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