1 | <?php |
||
17 | abstract class TableColumn implements ColumnInterface |
||
18 | { |
||
19 | use HtmlAttributes, Assets, Renderable; |
||
20 | |||
21 | /** |
||
22 | * Column header. |
||
23 | * |
||
24 | * @var TableHeaderColumnInterface |
||
25 | */ |
||
26 | protected $header; |
||
27 | |||
28 | /** |
||
29 | * Model instance currently rendering. |
||
30 | * |
||
31 | * @var Model |
||
32 | */ |
||
33 | protected $model; |
||
34 | |||
35 | /** |
||
36 | * Column appendant. |
||
37 | * |
||
38 | * @var ColumnInterface |
||
39 | */ |
||
40 | protected $append; |
||
41 | |||
42 | /** |
||
43 | * Column width. |
||
44 | * |
||
45 | * @var string |
||
46 | */ |
||
47 | protected $width = null; |
||
48 | |||
49 | /** |
||
50 | * @var OrderByClauseInterface |
||
51 | */ |
||
52 | protected $orderByClause; |
||
53 | |||
54 | /** |
||
55 | * TableColumn constructor. |
||
56 | * |
||
57 | * @param string|null $label |
||
58 | */ |
||
59 | public function __construct($label = null) |
||
69 | |||
70 | /** |
||
71 | * Initialize column. |
||
72 | */ |
||
73 | public function initialize() |
||
77 | |||
78 | /** |
||
79 | * @return TableHeaderColumnInterface |
||
80 | */ |
||
81 | public function getHeader() |
||
85 | |||
86 | /** |
||
87 | * @return int |
||
88 | */ |
||
89 | public function getWidth() |
||
93 | |||
94 | /** |
||
95 | * @param int|string $width |
||
96 | * |
||
97 | * @return $this |
||
98 | */ |
||
99 | public function setWidth($width) |
||
109 | |||
110 | /** |
||
111 | * @return ColumnInterface |
||
112 | */ |
||
113 | public function getAppends() |
||
117 | |||
118 | /** |
||
119 | * @param ColumnInterface $append |
||
120 | * |
||
121 | * @return $this |
||
122 | */ |
||
123 | public function append(ColumnInterface $append) |
||
129 | |||
130 | /** |
||
131 | * @return Model $model |
||
132 | */ |
||
133 | public function getModel() |
||
137 | |||
138 | /** |
||
139 | * @param Model $model |
||
140 | * |
||
141 | * @return $this |
||
142 | */ |
||
143 | public function setModel(Model $model) |
||
154 | |||
155 | /** |
||
156 | * Set column header label. |
||
157 | * |
||
158 | * @param string $title |
||
159 | * |
||
160 | * @return $this |
||
161 | */ |
||
162 | public function setLabel($title) |
||
168 | |||
169 | /** |
||
170 | * @param OrderByClauseInterface|bool|string|\Closure $orderable |
||
171 | * |
||
172 | * @return $this |
||
173 | */ |
||
174 | public function setOrderable($orderable) |
||
189 | |||
190 | /** |
||
191 | * Check if column is orderable. |
||
192 | * @return bool |
||
193 | */ |
||
194 | public function isOrderable() |
||
198 | |||
199 | /** |
||
200 | * @param Builder $query |
||
201 | * @param string $direction |
||
202 | * |
||
203 | * @return $this |
||
204 | */ |
||
205 | public function orderBy(Builder $query, $direction) |
||
215 | |||
216 | /** |
||
217 | * Get the instance as an array. |
||
218 | * |
||
219 | * @return array |
||
220 | */ |
||
221 | public function toArray() |
||
229 | |||
230 | /** |
||
231 | * Get related model configuration. |
||
232 | * @return ModelConfigurationInterface |
||
233 | */ |
||
234 | protected function getModelConfiguration() |
||
238 | } |
||
239 |
If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:
If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.