TemplateFormField   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 65
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 1

Importance

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

5 Methods

Rating   Name   Duplication   Size   Complexity  
init() 0 1 ?
A getControl() 0 3 1
A setControl() 0 4 1
A setField() 0 4 1
A setPostInitHook() 0 3 1
1
<?php
2
3
/*
4
 * Copyright (C) 2015 Michael Herold <[email protected]>
5
 *
6
 * This program is free software: you can redistribute it and/or modify
7
 * it under the terms of the GNU General Public License as published by
8
 * the Free Software Foundation, either version 3 of the License, or
9
 * (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
18
 */
19
20
namespace hemio\form\Abstract_;
21
22
use hemio\html\Interface_\Submittable;
23
24
/**
25
 * 
26
 *
27
 * @author Michael Herold <[email protected]>
28
 */
29
abstract class TemplateFormField extends Template {
30
31
    /**
32
     *
33
     * @var string
34
     */
35
    public $title;
36
37
    /**
38
     *
39
     * @var \hemio\html\Interface_\Submittable
40
     */
41
    protected $control;
42
43
    /**
44
     *
45
     * @var Abstract_\FormField
46
     */
47
    public $field;
48
49
    /**
50
     *
51
     * @var callable
52
     */
53
    protected $postInitHook;
54
55
    abstract public function init(FormField $field, Submittable $control);
56
57
    /**
58
     * 
59
     * @return \hemio\html\Interface_\Submittable
60
     */
61
    public function getControl() {
62
        return $this->control;
63
    }
64
65
    /**
66
     * 
67
     * @param \hemio\html\Interface_\Submittable $control
68
     * @return \hemio\html\Interface_\Submittable
69
     */
70
    public function setControl(\hemio\html\Interface_\Submittable $control) {
71
        $this->control = $control;
72
        return $control;
73
    }
74
75
    /**
76
     * 
77
     * @param \hemio\form\Abstract_\FormField $field
78
     * @return \hemio\form\Abstract_\FormField
79
     */
80
    public function setField(FormField $field) {
81
        $this->field = $field;
0 ignored issues
show
Documentation Bug introduced by
It seems like $field of type object<hemio\form\Abstract_\FormField> is incompatible with the declared type object<hemio\form\Abstract_\Abstract_\FormField> of property $field.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
82
        return $field;
83
    }
84
85
    /**
86
     * 
87
     * @param \hemio\form\Abstract_\callable $function
88
     */
89
    public function setPostInitHook(callable $function) {
90
        $this->postInitHook = $function;
91
    }
92
93
}
94