This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace Yajra\DataTables\Html; |
||
4 | |||
5 | use Yajra\DataTables\Html\Options; |
||
6 | |||
7 | /** |
||
8 | * DataTables - Options builder. |
||
9 | * |
||
10 | * @see https://datatables.net/reference/option/ |
||
11 | */ |
||
12 | trait HasOptions |
||
13 | { |
||
14 | use Options\HasFeatures; |
||
15 | use Options\HasData; |
||
16 | use Options\HasCallbacks; |
||
17 | use Options\HasColumns; |
||
18 | use Options\HasInternationalisation; |
||
19 | use Options\Plugins\AutoFill; |
||
20 | use Options\Plugins\Buttons; |
||
21 | use Options\Plugins\ColReorder; |
||
22 | use Options\Plugins\FixedColumns; |
||
23 | use Options\Plugins\FixedHeader; |
||
24 | use Options\Plugins\KeyTable; |
||
25 | use Options\Plugins\Responsive; |
||
26 | use Options\Plugins\RowGroup; |
||
27 | use Options\Plugins\RowReorder; |
||
28 | use Options\Plugins\Scroller; |
||
29 | use Options\Plugins\Select; |
||
30 | use Options\Plugins\SearchPanes; |
||
31 | |||
32 | /** |
||
33 | * Set deferLoading option value. |
||
34 | * |
||
35 | * @param mixed $value |
||
36 | * @return $this |
||
37 | * @see https://datatables.net/reference/option/deferLoading |
||
38 | */ |
||
39 | public function deferLoading($value = null) |
||
40 | { |
||
41 | $this->attributes['deferLoading'] = $value; |
||
42 | |||
43 | return $this; |
||
44 | } |
||
45 | |||
46 | /** |
||
47 | * Set destroy option value. |
||
48 | * |
||
49 | * @param bool $value |
||
50 | * @return $this |
||
51 | * @see https://datatables.net/reference/option/destroy |
||
52 | */ |
||
53 | public function destroy(bool $value = false) |
||
54 | { |
||
55 | $this->attributes['destroy'] = $value; |
||
56 | |||
57 | return $this; |
||
58 | } |
||
59 | |||
60 | /** |
||
61 | * Set displayStart option value. |
||
62 | * |
||
63 | * @param int $value |
||
64 | * @return $this |
||
65 | * @see https://datatables.net/reference/option/displayStart |
||
66 | */ |
||
67 | public function displayStart(int $value = 0) |
||
68 | { |
||
69 | $this->attributes['displayStart'] = $value; |
||
70 | |||
71 | return $this; |
||
72 | } |
||
73 | |||
74 | /** |
||
75 | * Set dom option value. |
||
76 | * |
||
77 | * @param string $value |
||
78 | * @return $this |
||
79 | * @see https://datatables.net/reference/option/dom |
||
80 | */ |
||
81 | public function dom(string $value) |
||
82 | { |
||
83 | $this->attributes['dom'] = $value; |
||
84 | |||
85 | return $this; |
||
86 | } |
||
87 | |||
88 | /** |
||
89 | * Set lengthMenu option value. |
||
90 | * |
||
91 | * @param array $value |
||
92 | * @return $this |
||
93 | * @see https://datatables.net/reference/option/lengthMenu |
||
94 | */ |
||
95 | public function lengthMenu(array $value = [10, 25, 50, 100]) |
||
96 | { |
||
97 | $this->attributes['lengthMenu'] = $value; |
||
98 | |||
99 | return $this; |
||
100 | } |
||
101 | |||
102 | /** |
||
103 | * Set orders option value. |
||
104 | * |
||
105 | * @param array $value |
||
106 | * @return $this |
||
107 | * @see https://datatables.net/reference/option/order |
||
108 | */ |
||
109 | public function orders(array $value) |
||
110 | { |
||
111 | $this->attributes['order'] = $value; |
||
112 | |||
113 | return $this; |
||
114 | } |
||
115 | |||
116 | /** |
||
117 | * Set orderCellsTop option value. |
||
118 | * |
||
119 | * @param bool $value |
||
120 | * @return $this |
||
121 | * @see https://datatables.net/reference/option/orderCellsTop |
||
122 | */ |
||
123 | public function orderCellsTop(bool $value = false) |
||
124 | { |
||
125 | $this->attributes['orderCellsTop'] = $value; |
||
126 | |||
127 | return $this; |
||
128 | } |
||
129 | |||
130 | /** |
||
131 | * Set orderClasses option value. |
||
132 | * |
||
133 | * @param bool $value |
||
134 | * @return $this |
||
135 | * @see https://datatables.net/reference/option/orderClasses |
||
136 | */ |
||
137 | public function orderClasses(bool $value = true) |
||
138 | { |
||
139 | $this->attributes['orderClasses'] = $value; |
||
140 | |||
141 | return $this; |
||
142 | } |
||
143 | |||
144 | /** |
||
145 | * Order option builder. |
||
146 | * |
||
147 | * @param int|array $index |
||
148 | * @param string $direction |
||
149 | * @return $this |
||
150 | * @see https://datatables.net/reference/option/order |
||
151 | */ |
||
152 | View Code Duplication | public function orderBy($index, $direction = 'desc') |
|
0 ignored issues
–
show
|
|||
153 | { |
||
154 | if ($direction != 'desc') { |
||
155 | $direction = 'asc'; |
||
156 | } |
||
157 | |||
158 | if (is_array($index)) { |
||
159 | $this->attributes['order'][] = $index; |
||
160 | } else { |
||
161 | $this->attributes['order'][] = [$index, $direction]; |
||
162 | } |
||
163 | |||
164 | return $this; |
||
165 | } |
||
166 | |||
167 | /** |
||
168 | * Order Fixed option builder. |
||
169 | * |
||
170 | * @param int|array $index |
||
171 | * @param string $direction |
||
172 | * @return $this |
||
173 | * @see https://datatables.net/reference/option/orderFixed |
||
174 | */ |
||
175 | View Code Duplication | public function orderByFixed($index, $direction = 'desc') |
|
0 ignored issues
–
show
This method seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository.
Loading history...
|
|||
176 | { |
||
177 | if ($direction != 'desc') { |
||
178 | $direction = 'asc'; |
||
179 | } |
||
180 | |||
181 | if (is_array($index)) { |
||
182 | $this->attributes['orderFixed'][] = $index; |
||
183 | } else { |
||
184 | $this->attributes['orderFixed'][] = [$index, $direction]; |
||
185 | } |
||
186 | |||
187 | return $this; |
||
188 | } |
||
189 | |||
190 | /** |
||
191 | * Set orderMulti option value. |
||
192 | * |
||
193 | * @param bool $value |
||
194 | * @return $this |
||
195 | * @see https://datatables.net/reference/option/orderMulti |
||
196 | */ |
||
197 | public function orderMulti(bool $value = true) |
||
198 | { |
||
199 | $this->attributes['orderMulti'] = $value; |
||
200 | |||
201 | return $this; |
||
202 | } |
||
203 | |||
204 | /** |
||
205 | * Set pageLength option value. |
||
206 | * |
||
207 | * @param int $value |
||
208 | * @return $this |
||
209 | * @see https://datatables.net/reference/option/pageLength |
||
210 | */ |
||
211 | public function pageLength(int $value = 10) |
||
212 | { |
||
213 | $this->attributes['pageLength'] = $value; |
||
214 | |||
215 | return $this; |
||
216 | } |
||
217 | |||
218 | /** |
||
219 | * Set pagingType option value. |
||
220 | * |
||
221 | * @param string $value |
||
222 | * @return $this |
||
223 | * @see https://datatables.net/reference/option/pagingType |
||
224 | */ |
||
225 | public function pagingType(string $value = 'simple_numbers') |
||
226 | { |
||
227 | $this->attributes['pagingType'] = $value; |
||
228 | |||
229 | return $this; |
||
230 | } |
||
231 | |||
232 | /** |
||
233 | * Set renderer option value. |
||
234 | * |
||
235 | * @param mixed $value |
||
236 | * @return $this |
||
237 | * @see https://datatables.net/reference/option/renderer |
||
238 | */ |
||
239 | public function renderer($value = 'bootstrap') |
||
240 | { |
||
241 | $this->attributes['renderer'] = $value; |
||
242 | |||
243 | return $this; |
||
244 | } |
||
245 | |||
246 | /** |
||
247 | * Set retrieve option value. |
||
248 | * |
||
249 | * @param bool $value |
||
250 | * @return $this |
||
251 | * @see https://datatables.net/reference/option/retrieve |
||
252 | */ |
||
253 | public function retrieve(bool $value = false) |
||
254 | { |
||
255 | $this->attributes['retrieve'] = $value; |
||
256 | |||
257 | return $this; |
||
258 | } |
||
259 | |||
260 | /** |
||
261 | * Set rowId option value. |
||
262 | * |
||
263 | * @param string $value |
||
264 | * @return $this |
||
265 | * @see https://datatables.net/reference/option/rowId |
||
266 | */ |
||
267 | public function rowId(string $value = 'DT_RowId') |
||
268 | { |
||
269 | $this->attributes['rowId'] = $value; |
||
270 | |||
271 | return $this; |
||
272 | } |
||
273 | |||
274 | /** |
||
275 | * Set scrollCollapse option value. |
||
276 | * |
||
277 | * @param mixed $value |
||
278 | * @return $this |
||
279 | * @see https://datatables.net/reference/option/scrollCollapse |
||
280 | */ |
||
281 | public function scrollCollapse($value = false) |
||
282 | { |
||
283 | $this->attributes['scrollCollapse'] = $value; |
||
284 | |||
285 | return $this; |
||
286 | } |
||
287 | |||
288 | /** |
||
289 | * Set search option value. |
||
290 | * |
||
291 | * @param array $value |
||
292 | * @return $this |
||
293 | * @see https://datatables.net/reference/option/search |
||
294 | */ |
||
295 | public function search(array $value) |
||
296 | { |
||
297 | $this->attributes['search'] = $value; |
||
298 | |||
299 | return $this; |
||
300 | } |
||
301 | |||
302 | /** |
||
303 | * Set searchCols option value. |
||
304 | * |
||
305 | * @param array $value |
||
306 | * @return $this |
||
307 | * @see https://datatables.net/reference/option/searchCols |
||
308 | */ |
||
309 | public function searchCols(array $value) |
||
310 | { |
||
311 | $this->attributes['searchCols'] = $value; |
||
312 | |||
313 | return $this; |
||
314 | } |
||
315 | |||
316 | /** |
||
317 | * Set searchDelay option value. |
||
318 | * |
||
319 | * @param int $value |
||
320 | * @return $this |
||
321 | * @see https://datatables.net/reference/option/searchDelay |
||
322 | */ |
||
323 | public function searchDelay(int $value) |
||
324 | { |
||
325 | $this->attributes['searchDelay'] = $value; |
||
326 | |||
327 | return $this; |
||
328 | } |
||
329 | |||
330 | /** |
||
331 | * Set stateDuration option value. |
||
332 | * |
||
333 | * @param int $value |
||
334 | * @return $this |
||
335 | * @see https://datatables.net/reference/option/stateDuration |
||
336 | */ |
||
337 | public function stateDuration(int $value) |
||
338 | { |
||
339 | $this->attributes['stateDuration'] = $value; |
||
340 | |||
341 | return $this; |
||
342 | } |
||
343 | |||
344 | /** |
||
345 | * Set stripeClasses option value. |
||
346 | * |
||
347 | * @param array $value |
||
348 | * @return $this |
||
349 | * @see https://datatables.net/reference/option/stripeClasses |
||
350 | */ |
||
351 | public function stripeClasses(array $value) |
||
352 | { |
||
353 | $this->attributes['stripeClasses'] = $value; |
||
354 | |||
355 | return $this; |
||
356 | } |
||
357 | |||
358 | /** |
||
359 | * Set tabIndex option value. |
||
360 | * |
||
361 | * @param int $value |
||
362 | * @return $this |
||
363 | * @see https://datatables.net/reference/option/tabIndex |
||
364 | */ |
||
365 | public function tabIndex(int $value = 0) |
||
366 | { |
||
367 | $this->attributes['tabIndex'] = $value; |
||
368 | |||
369 | return $this; |
||
370 | } |
||
371 | } |
||
372 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.