1 | <?php |
||
13 | abstract class FormFieldDefault extends FormField implements form_\Focusable { |
||
14 | |||
15 | |||
16 | /** |
||
17 | * |
||
18 | * @var string |
||
19 | */ |
||
20 | public $title = ''; |
||
21 | |||
22 | /** |
||
23 | * |
||
24 | * @var boolean |
||
25 | */ |
||
26 | protected $filled = false; |
||
27 | |||
28 | /** |
||
29 | * |
||
30 | * @var html\Interface_\Submittable |
||
31 | */ |
||
32 | protected $control; |
||
33 | |||
34 | /** |
||
35 | * |
||
36 | * @var string |
||
37 | */ |
||
38 | protected $defaultValue = ''; |
||
39 | |||
40 | /** |
||
41 | * |
||
42 | * @param mixed $value |
||
43 | */ |
||
44 | public function setDefaultValue($value) { |
||
47 | |||
48 | /** |
||
49 | * @return mixed Default value |
||
50 | */ |
||
51 | public function getValueDefault() { |
||
54 | |||
55 | public function getValueStored() { |
||
59 | |||
60 | public function getValueToUse() { |
||
68 | |||
69 | /** |
||
70 | * |
||
71 | * @return html\Input |
||
72 | */ |
||
73 | public function getControlElement() { |
||
76 | |||
77 | /** |
||
78 | * |
||
79 | * @param string $name |
||
80 | * @param string $title |
||
81 | * @param html\Interface_\Submittable $control |
||
82 | */ |
||
83 | public function init($name, $title, $control, $idSuffix = null) { |
||
91 | |||
92 | /** |
||
93 | * |
||
94 | * @return TemplateFormField |
||
95 | * @throws exception\NotLazyEnough |
||
96 | * @throws exception\AppendageTypeError |
||
97 | */ |
||
98 | public function getFieldTemplateClone($special = null) { |
||
124 | |||
125 | public function describe() { |
||
128 | |||
129 | /** |
||
130 | * |
||
131 | * @return string |
||
132 | */ |
||
133 | public function __toString() { |
||
139 | |||
140 | abstract public function fill(); |
||
141 | |||
142 | public function setForm(Form $form) { |
||
147 | |||
148 | public function setAccessKey($key) { |
||
151 | |||
152 | public function getHtmlTitle() { |
||
184 | |||
185 | protected $autofocusLevel = 5; |
||
186 | |||
187 | /** |
||
188 | * |
||
189 | * @param bool $focus |
||
190 | */ |
||
191 | public function setAutofocus($focus = true, $level = 10) { |
||
197 | |||
198 | public function getAutofocusLevel() { |
||
201 | |||
202 | public function engageAutofocus() { |
||
205 | |||
206 | /** |
||
207 | * |
||
208 | * @param boolean $required |
||
209 | */ |
||
210 | public function setRequired($required = true) { |
||
215 | |||
216 | } |
||
217 |
PHP Analyzer performs a side-effects analysis of your code. A side-effect is basically anything that might be visible after the scope of the method is left.
Let’s take a look at an example:
If we look at the
getEmail()
method, we can see that it has no side-effect. Whether you call this method or not, no future calls to other methods are affected by this. As such code as the following is useless:On the hand, if we look at the
setEmail()
, this method _has_ side-effects. In the following case, we could not remove the method call: