Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.
Common duplication problems, and corresponding solutions are:
1 | <?php |
||
8 | class WidgetsDataTable extends DataTable |
||
9 | { |
||
10 | /** |
||
11 | * Display ajax response. |
||
12 | * |
||
13 | * @return \Illuminate\Http\JsonResponse |
||
14 | */ |
||
15 | public function ajax() |
||
29 | |||
30 | /** |
||
31 | * Get the query object to be processed by datatables. |
||
32 | * |
||
33 | * @return \Illuminate\Database\Query\Builder|\Illuminate\Database\Eloquent\Builder |
||
34 | */ |
||
35 | public function query() |
||
48 | |||
49 | /** |
||
50 | * Optional method if you want to use html builder. |
||
51 | * |
||
52 | * @return \Yajra\Datatables\Html\Builder |
||
53 | */ |
||
54 | View Code Duplication | public function html() |
|
62 | |||
63 | /** |
||
64 | * Get columns. |
||
65 | * |
||
66 | * @return array |
||
67 | */ |
||
68 | private function getColumns() |
||
97 | |||
98 | /** |
||
99 | * @return array |
||
100 | */ |
||
101 | View Code Duplication | protected function getBuilderParameters() |
|
118 | |||
119 | /** |
||
120 | * Get filename for export. |
||
121 | * |
||
122 | * @return string |
||
123 | */ |
||
124 | protected function filename() |
||
128 | } |
||
129 |
This check marks calls to methods that do not seem to exist on an object.
This is most likely the result of a method being renamed without all references to it being renamed likewise.