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 DevicesDataTable extends DataTable |
||
9 | { |
||
10 | /** |
||
11 | * Build DataTable class. |
||
12 | * |
||
13 | * @return \Yajra\Datatables\Engines\BaseEngine |
||
14 | */ |
||
15 | public function dataTable() |
||
25 | |||
26 | /** |
||
27 | * Get the query object to be processed by dataTables. |
||
28 | * |
||
29 | * @return \Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Query\Builder|\Illuminate\Support\Collection |
||
30 | */ |
||
31 | public function query() |
||
46 | |||
47 | /** |
||
48 | * Optional method if you want to use html builder. |
||
49 | * |
||
50 | * @return \Yajra\Datatables\Html\Builder |
||
51 | */ |
||
52 | View Code Duplication | public function html() |
|
73 | |||
74 | /** |
||
75 | * Get columns. |
||
76 | * |
||
77 | * @return array |
||
78 | */ |
||
79 | protected function getColumns() |
||
89 | |||
90 | /** |
||
91 | * Get filename for export. |
||
92 | * |
||
93 | * @return string |
||
94 | */ |
||
95 | protected function filename() |
||
99 | } |
||
100 |
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.