1 | <?php |
||
5 | trait PlainInput |
||
6 | { |
||
7 | protected $prepend; |
||
8 | |||
9 | protected $append; |
||
10 | |||
11 | public function prependIcon($icon, $class = "") |
||
19 | |||
20 | public function appendIcon($icon, $class = "") |
||
28 | |||
29 | public function prepend($string) |
||
37 | |||
38 | public function append($string) |
||
46 | |||
47 | protected function initPlainInput() |
||
53 | |||
54 | protected function defaultAttribute($attribute, $value) |
||
62 | } |
||
63 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: