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