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

FormModelSearchWidget   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 17 1
A callbackSubmit() 0 6 1
1
<?php
2
3
namespace Anax\HTMLForm;
4
5
/**
6
 * Example of FormModel implementation.
7
 */
8
class FormModelSearchWidget extends FormModel
9
{
10
    /**
11
     * Constructor
12
     */
13
    public function __construct()
14
    {
15
        parent::__construct(
16
            [
17
                "id" => __CLASS__,
18
            ],
19
            [
20
                "search" => [
21
                    "type"        => "search-widget",
22
                    "description" => "Here you can place a description.",
23
                    "placeholder" => "Here is a placeholder",
24
                    "label"       => "Search",
25
                    "callback"    => [$this, "callbackSubmit"],
26
                ]
27
            ]
28
        );
29
    }
30
31
32
33
    /**
34
     * Callback for submit-button.
35
     */
36
    public function callbackSubmit()
37
    {
38
        $this->AddOutput("<p>You searched for '" . $this->value("search") . "'.</p>");
39
        $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...
40
        return true;
41
    }
42
}
43