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

FormModelSelectOption   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 54
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 54
rs 10
c 0
b 0
f 0
wmc 2
lcom 0
cbo 1

2 Methods

Rating   Name   Duplication   Size   Complexity  
B __construct() 0 34 1
A callbackSubmit() 0 8 1
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