1 | <?php |
||
15 | trait TButton |
||
16 | { |
||
17 | |||
18 | /** |
||
19 | * @var string |
||
20 | */ |
||
21 | protected $title = ''; |
||
22 | |||
23 | /** |
||
24 | * @var string |
||
25 | */ |
||
26 | protected $class = 'btn btn-xs btn-default'; |
||
27 | |||
28 | /** |
||
29 | * @var string |
||
30 | */ |
||
31 | protected $icon; |
||
32 | |||
33 | /** |
||
34 | * @var string |
||
35 | */ |
||
36 | protected $text = ''; |
||
37 | |||
38 | |||
39 | /** |
||
40 | * Should the element has an icon? |
||
41 | * @param Html $el |
||
42 | * @param string|null $icon |
||
43 | * @param string $name |
||
44 | * @return void |
||
45 | */ |
||
46 | public function tryAddIcon($el, $icon, $name) |
||
56 | |||
57 | |||
58 | /** |
||
59 | * Set attribute title |
||
60 | * @param string $title |
||
61 | */ |
||
62 | public function setTitle($title) |
||
68 | |||
69 | |||
70 | /** |
||
71 | * Get attribute title |
||
72 | * @return string |
||
73 | */ |
||
74 | public function getTitle() |
||
78 | |||
79 | |||
80 | /** |
||
81 | * Set attribute class |
||
82 | * @param string $class |
||
83 | */ |
||
84 | public function setClass($class) |
||
90 | |||
91 | |||
92 | /** |
||
93 | * Get attribute class |
||
94 | * @return string |
||
95 | */ |
||
96 | public function getClass() |
||
100 | |||
101 | |||
102 | /** |
||
103 | * Set icon |
||
104 | * @param string $icon |
||
105 | */ |
||
106 | public function setIcon($icon) |
||
112 | |||
113 | |||
114 | /** |
||
115 | * Get icon |
||
116 | * @return string |
||
117 | */ |
||
118 | public function getIcon() |
||
122 | |||
123 | |||
124 | /** |
||
125 | * Set text |
||
126 | * @param string $text |
||
127 | */ |
||
128 | public function setText($text) |
||
134 | |||
135 | |||
136 | /** |
||
137 | * Get text |
||
138 | * @return string |
||
139 | */ |
||
140 | public function getText() |
||
144 | |||
145 | } |
||
146 |
In PHP, under loose comparison (like
==
, or!=
, orswitch
conditions), values of different types might be equal.For
string
values, the empty string''
is a special case, in particular the following results might be unexpected: