Total Complexity | 5 |
Total Lines | 51 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
5 | class HandleListAction |
||
6 | { |
||
7 | /** |
||
8 | * @param $table |
||
9 | * @param $data |
||
10 | * @param $responsesFields |
||
11 | * @return array |
||
12 | */ |
||
13 | public static function handleListAction($table, $data, $responsesFields, $ctrl) |
||
14 | { |
||
15 | $rows = self::sortRows($table, $data); |
||
16 | if ($rows) { |
||
17 | return self::handleRows($responsesFields, $rows); |
||
18 | } |
||
19 | $result = ApiResponder::makeResult(0, 'No data found !'); |
||
20 | $result['data'] = []; |
||
21 | ApiResponder::send($result, request()->all(), $ctrl); |
||
22 | } |
||
23 | |||
24 | /** |
||
25 | * @param $responsesFields |
||
26 | * @param $rows |
||
27 | * @return array |
||
28 | */ |
||
29 | private static function handleRows($responsesFields, $rows) |
||
39 | } |
||
40 | |||
41 | |||
42 | /** |
||
43 | * @param $table |
||
44 | * @param $data |
||
45 | * @return mixed |
||
46 | */ |
||
47 | private static function sortRows($table, $data) |
||
58 | } |