We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
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 |
||
11 | View Code Duplication | class ToneCrudController extends BaseController |
|
|
|||
12 | { |
||
13 | protected $crud; |
||
14 | protected $data; |
||
15 | |||
16 | public function __construct() |
||
21 | |||
22 | /** |
||
23 | * Display a listing of the resource. |
||
24 | * |
||
25 | * @return \Illuminate\Http\Response |
||
26 | */ |
||
27 | public function index() |
||
34 | |||
35 | /** |
||
36 | * Show the form for creating a new resource. |
||
37 | * |
||
38 | * @return \Illuminate\Http\Response |
||
39 | */ |
||
40 | public function create() |
||
47 | |||
48 | /** |
||
49 | * Store a newly created resource in storage. |
||
50 | * |
||
51 | * @param \Illuminate\Http\Request $request |
||
52 | * |
||
53 | * @return \Illuminate\Http\Response |
||
54 | */ |
||
55 | public function crudStore(Request $request = null) |
||
64 | |||
65 | /** |
||
66 | * Display the specified resource. |
||
67 | * |
||
68 | * @param int $id |
||
69 | * |
||
70 | * @return \Illuminate\Http\Response |
||
71 | */ |
||
72 | public function show($id) |
||
79 | |||
80 | /** |
||
81 | * Show the form for editing the specified resource. |
||
82 | * |
||
83 | * @param int $id |
||
84 | * |
||
85 | * @return \Illuminate\Http\Response |
||
86 | */ |
||
87 | public function edit($id) |
||
96 | |||
97 | /** |
||
98 | * Update the specified resource in storage. |
||
99 | * |
||
100 | * @param \Illuminate\Http\Request $request |
||
101 | * @param int $id |
||
102 | * |
||
103 | * @return \Illuminate\Http\Response |
||
104 | */ |
||
105 | public function crudUpdate($id, Request $request = null) |
||
114 | |||
115 | /** |
||
116 | * Remove the specified resource from storage. |
||
117 | * |
||
118 | * @param int $id |
||
119 | * |
||
120 | * @return \Illuminate\Http\Response |
||
121 | */ |
||
122 | public function destroy($id) |
||
128 | } |
||
129 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.