Test Failed
Push — master ( 194522...eda1b6 )
by Mikael
01:43
created

FormModelSelectOption::__construct()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 34
Code Lines 23

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 23
nc 1
nop 0
dl 0
loc 34
rs 8.8571
c 0
b 0
f 0
1
<?php
2
3
namespace Anax\HTMLForm;
4
5
/**
6
 * Example of FormModel implementation.
7
 */
8
class FormModelSelectOption extends FormModel
9
{
10
    /**
11
     * Constructor
12
     */
13
    public function __construct()
14
    {
15
        parent::__construct(
16
            [],
17
            [
18
                "expmonth" => [
19
                    "type" => "select",
20
                    "label" => "Expiration month:",
21
                    
22
                    "options" => [
23
                        "default" => "Select credit card expiration month...",
24
                        "01" => "January",
25
                        "02" => "February",
26
                        "03" => "March",
27
                        "04" => "April",
28
                        "05" => "May",
29
                        "06" => "June",
30
                        "07" => "July",
31
                        "08" => "August",
32
                        "09" => "September",
33
                        "10" => "October",
34
                        "11" => "November",
35
                        "12" => "December",
36
                    ],
37
                ],
38
                
39
                "doPay" => [
40
                    "type" => "submit",
41
                    "value" => "Perform payment",
42
                    "callback" => [$this, "callbackSubmit"]
43
                ],
44
            ]
45
        );
46
    }
47
48
49
50
    /**
51
     * Callback for submit-button.
52
     */
53
    public function callbackSubmit()
54
    {
55
        $this->AddOutput("<p>#callbackSubmit()</p>");
56
        $this->AddOutput("<p>Selected month is: " . $this->value("expmonth") . "</p>");
57
        $this->saveInSession = true;
0 ignored issues
show
Bug introduced by
The property saveInSession does not seem to exist. Did you mean session?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
58
59
        return true;
60
    }
61
}
62