1 | <?php |
||
9 | abstract class Column implements ColumnInterface |
||
10 | { |
||
11 | protected $name; |
||
12 | |||
13 | protected $label; |
||
14 | |||
15 | protected $width = 0; |
||
16 | |||
17 | protected $minWidth = 80; |
||
18 | |||
19 | protected $sortable = false; |
||
20 | |||
21 | protected $fixed = false; |
||
22 | |||
23 | /** |
||
24 | * @var Model |
||
25 | */ |
||
26 | protected $model; |
||
27 | |||
28 | protected $defaultValue = ''; |
||
29 | |||
30 | protected $template; |
||
31 | |||
32 | public function __construct($name, $label) |
||
36 | |||
37 | /** |
||
38 | * @return string |
||
39 | */ |
||
40 | public function getName() |
||
44 | |||
45 | /** |
||
46 | * @param string $name |
||
47 | * |
||
48 | * @return Column |
||
49 | */ |
||
50 | public function setName($name) |
||
56 | |||
57 | /** |
||
58 | * @return string |
||
59 | */ |
||
60 | public function getLabel() |
||
64 | |||
65 | /** |
||
66 | * @param string $label |
||
67 | * |
||
68 | * @return Column |
||
69 | */ |
||
70 | public function setLabel(string $label) |
||
76 | |||
77 | /** |
||
78 | * @return int |
||
79 | */ |
||
80 | public function getWidth() |
||
84 | |||
85 | /** |
||
86 | * @param int $width |
||
87 | * |
||
88 | * @return Column |
||
89 | */ |
||
90 | public function setWidth(int $width) |
||
96 | |||
97 | /** |
||
98 | * @return int |
||
99 | */ |
||
100 | public function getMinWidth() |
||
104 | |||
105 | /** |
||
106 | * @param int $minWidth |
||
107 | * |
||
108 | * @return Column |
||
109 | */ |
||
110 | public function setMinWidth(int $minWidth) |
||
116 | |||
117 | public function sortable() |
||
123 | |||
124 | public function customSortable() |
||
132 | |||
133 | public function enableFixed() |
||
139 | |||
140 | public function getModel() |
||
144 | |||
145 | public function setModel(Model $model) |
||
151 | |||
152 | /** |
||
153 | * @return string |
||
154 | */ |
||
155 | public function getTemplate() |
||
159 | |||
160 | /** |
||
161 | * @param string $template |
||
162 | * |
||
163 | * @return Column |
||
164 | */ |
||
165 | public function setTemplate(string $template) |
||
171 | |||
172 | /** |
||
173 | * The column options |
||
174 | * |
||
175 | * @return array |
||
176 | */ |
||
177 | public function toArray() |
||
189 | |||
190 | /** |
||
191 | * Set the column default value |
||
192 | * |
||
193 | * @param mixed $value |
||
194 | * |
||
195 | * @return $this |
||
196 | */ |
||
197 | public function setDefaultValue($value) |
||
203 | |||
204 | public function getDefaultValue() |
||
208 | |||
209 | /** |
||
210 | * Get the column value |
||
211 | * |
||
212 | * @return string|static |
||
213 | */ |
||
214 | public function getValue() |
||
223 | |||
224 | protected function getModelValue() |
||
228 | |||
229 | protected function getValueFromObject($instance, $name) |
||
246 | |||
247 | public function jsonSerialize() |
||
251 | |||
252 | public function toJson($options = 0) |
||
256 | |||
257 | public function __toString() |
||
261 | } |
||
262 |
This check looks for assignments to scalar types that may be of the wrong type.
To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.