1 | <?php |
||
7 | trait HasTable |
||
8 | { |
||
9 | /** |
||
10 | * Retrieves HTML table attribute value. |
||
11 | * |
||
12 | * @param string $attribute |
||
13 | * @return mixed |
||
14 | * @throws \Exception |
||
15 | */ |
||
16 | public function getTableAttribute($attribute) |
||
24 | |||
25 | /** |
||
26 | * Get table computed table attributes. |
||
27 | * |
||
28 | * @return array |
||
29 | */ |
||
30 | public function getTableAttributes() |
||
34 | |||
35 | /** |
||
36 | * Sets HTML table "id" attribute. |
||
37 | * |
||
38 | * @param string $id |
||
39 | * @return $this |
||
40 | */ |
||
41 | public function setTableId($id) |
||
45 | |||
46 | /** |
||
47 | * Sets HTML table attribute(s). |
||
48 | * |
||
49 | * @param string|array $attribute |
||
50 | * @param mixed $value |
||
51 | * @return $this |
||
52 | */ |
||
53 | public function setTableAttribute($attribute, $value = null) |
||
63 | |||
64 | /** |
||
65 | * Sets multiple HTML table attributes at once. |
||
66 | * |
||
67 | * @param array $attributes |
||
68 | * @return $this |
||
69 | */ |
||
70 | public function setTableAttributes(array $attributes) |
||
78 | |||
79 | /** |
||
80 | * Add class names to the "class" attribute of HTML table. |
||
81 | * |
||
82 | * @param string|array $class |
||
83 | * @return $this |
||
84 | */ |
||
85 | public function addTableClass($class) |
||
95 | |||
96 | /** |
||
97 | * Remove class names from the "class" attribute of HTML table. |
||
98 | * |
||
99 | * @param string|array $class |
||
100 | * @return $this |
||
101 | */ |
||
102 | public function removeTableClass($class) |
||
115 | |||
116 | /** |
||
117 | * Compile table headers and to support responsive extension. |
||
118 | * |
||
119 | * @return array |
||
120 | */ |
||
121 | protected function compileTableHeaders() |
||
135 | |||
136 | /** |
||
137 | * Compile table search headers. |
||
138 | * |
||
139 | * @return array |
||
140 | */ |
||
141 | protected function compileTableSearchHeaders() |
||
150 | |||
151 | /** |
||
152 | * Compile table footer contents. |
||
153 | * |
||
154 | * @return array |
||
155 | */ |
||
156 | protected function compileTableFooter() |
||
172 | } |
||
173 |
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: