We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
1 | <?php |
||
5 | trait AjaxTable |
||
6 | { |
||
7 | /** |
||
8 | * Respond with the JSON of one or more rows, depending on the POST parameters. |
||
9 | * @return JSON Array of cells in HTML form. |
||
10 | */ |
||
11 | private $input; |
||
12 | private $totalRows = 0; |
||
13 | private $filteredRows = 0; |
||
14 | private $versionTransformer; |
||
15 | |||
16 | /** |
||
17 | * The search function. This function it's called by the data table. |
||
18 | * |
||
19 | * @return array |
||
20 | */ |
||
21 | public function search() |
||
42 | |||
43 | /** |
||
44 | * Formats the row of the table from the entry(instance of a model). |
||
45 | * |
||
46 | * @param $entry |
||
47 | * @return array |
||
48 | */ |
||
49 | private function format($entry) |
||
71 | |||
72 | /** |
||
73 | * Created the array to be fed to the data table. |
||
74 | * @param $data |
||
75 | * @return array |
||
76 | */ |
||
77 | private function make($data) |
||
91 | |||
92 | /** |
||
93 | * Checks of teh user has anything written in the search bar and if so a string with the filtered is returned. |
||
94 | * In case no filter is detected null is returned. |
||
95 | * |
||
96 | * @return null | string $filter |
||
97 | */ |
||
98 | private function addSearchConditions() |
||
107 | |||
108 | /** |
||
109 | * Checks if the user tried to order a column and if so an array with the |
||
110 | * column to be order and the direction are returned. |
||
111 | * |
||
112 | * @return array [column, direction] |
||
113 | */ |
||
114 | public function addAjaxOrderBy() |
||
125 | } |
||
126 |
Instead of super-globals, we recommend to explicitly inject the dependencies of your class. This makes your code less dependent on global state and it becomes generally more testable: