1 | <?php |
||
18 | class DisplayDatatablesAsync extends DisplayDatatables implements WithRoutesInterface |
||
19 | { |
||
20 | /** |
||
21 | * Register display routes. |
||
22 | * |
||
23 | * @param Router $router |
||
24 | */ |
||
25 | public static function registerRoutes(Router $router) |
||
42 | |||
43 | /** |
||
44 | * Find DisplayDatatablesAsync in tabbed display by name. |
||
45 | * |
||
46 | * @param DisplayTabbed $display |
||
47 | * @param string|null $name |
||
48 | * |
||
49 | * @return DisplayDatatablesAsync|null |
||
50 | */ |
||
51 | protected static function findDatatablesAsyncByName(DisplayTabbed $display, $name) |
||
61 | |||
62 | /** |
||
63 | * @var string |
||
64 | */ |
||
65 | protected $name; |
||
66 | |||
67 | /** |
||
68 | * @param string|null $name |
||
69 | */ |
||
70 | protected $distinct; |
||
71 | |||
72 | /** |
||
73 | * @var array |
||
74 | */ |
||
75 | protected $searchableColumns = [ |
||
76 | Text::class, |
||
77 | Link::class, |
||
78 | Email::class, |
||
79 | ]; |
||
80 | |||
81 | /** |
||
82 | * DisplayDatatablesAsync constructor. |
||
83 | * |
||
84 | * @param string|null $name |
||
85 | * @param string|null $distinct |
||
86 | */ |
||
87 | public function __construct($name = null, $distinct = null) |
||
96 | |||
97 | /** |
||
98 | * Initialize display. |
||
99 | */ |
||
100 | public function initialize() |
||
110 | |||
111 | /** |
||
112 | * @return string |
||
113 | */ |
||
114 | public function getName() |
||
118 | |||
119 | /** |
||
120 | * @param string $name |
||
121 | * |
||
122 | * @return $this |
||
123 | */ |
||
124 | public function setName($name) |
||
130 | |||
131 | /** |
||
132 | * @return mixed |
||
133 | */ |
||
134 | public function getDistinct() |
||
138 | |||
139 | /** |
||
140 | * @param mixed $distinct |
||
141 | * |
||
142 | * @return $this |
||
143 | */ |
||
144 | public function setDistinct($distinct) |
||
150 | |||
151 | /** |
||
152 | * Render async request. |
||
153 | * @return array |
||
154 | */ |
||
155 | public function renderAsync() |
||
179 | |||
180 | /** |
||
181 | * Apply offset and limit to the query. |
||
182 | * |
||
183 | * @param $query |
||
184 | */ |
||
185 | protected function applyOffset($query) |
||
196 | |||
197 | /** |
||
198 | * Apply orders to the query. |
||
199 | * |
||
200 | * @param $query |
||
201 | */ |
||
202 | protected function applyOrders($query) |
||
220 | |||
221 | /** |
||
222 | * Apply search to the query. |
||
223 | * |
||
224 | * @param Builder $query |
||
225 | */ |
||
226 | protected function applySearch(Builder $query) |
||
245 | |||
246 | /** |
||
247 | * @param Builder $query |
||
248 | */ |
||
249 | protected function applyColumnSearch(Builder $query) |
||
264 | |||
265 | /** |
||
266 | * Convert collection to the datatables structure. |
||
267 | * |
||
268 | * @param array|Collection $collection |
||
269 | * @param int $totalCount |
||
270 | * @param int $filteredCount |
||
271 | * |
||
272 | * @return array |
||
273 | */ |
||
274 | protected function prepareDatatablesStructure(Collection $collection, $totalCount, $filteredCount) |
||
297 | } |
||
298 |
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.