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 | ||
| 12 | class DashboardController extends Controller | ||
| 13 | { | ||
| 14 | |||
| 15 | use Helpers; | ||
| 16 | |||
| 17 |     public function __construct() { | ||
| 20 | |||
| 21 | /** | ||
| 22 | * Display a listing of all authorized devices | ||
| 23 | * | ||
| 24 | * @return \Illuminate\Http\Response | ||
| 25 | */ | ||
| 26 | public function index(Request $request) | ||
| 31 | |||
| 32 | /** | ||
| 33 | * Show the form for creating a new resource. | ||
| 34 | * | ||
| 35 | * @return \Illuminate\Http\Response | ||
| 36 | */ | ||
| 37 | public function create(Request $request) | ||
| 41 | |||
| 42 | /** | ||
| 43 | * Store a newly created resource in storage. | ||
| 44 | * | ||
| 45 | * @param \Illuminate\Http\Request $request | ||
| 46 | * @return \Illuminate\Http\Response | ||
| 47 | */ | ||
| 48 | public function store(Request $request) | ||
| 84 | |||
| 85 | /** | ||
| 86 | * Display the specified resource. | ||
| 87 | * | ||
| 88 | * @param int $id | ||
| 89 | * @return \Illuminate\Http\Response | ||
| 90 | */ | ||
| 91 | public function show(Request $request, $id) | ||
| 101 | |||
| 102 | /** | ||
| 103 | * Show the form for editing the specified resource. | ||
| 104 | * | ||
| 105 | * @param int $id | ||
| 106 | * @return \Illuminate\Http\Response | ||
| 107 | */ | ||
| 108 | public function edit($id) | ||
| 112 | |||
| 113 | /** | ||
| 114 | * Update the specified resource in storage. | ||
| 115 | * | ||
| 116 | * @param \Illuminate\Http\Request $request | ||
| 117 | * @param int $id | ||
| 118 | * @return \Illuminate\Http\Response | ||
| 119 | */ | ||
| 120 | public function update(Request $request, $id) | ||
| 144 | |||
| 145 | /** | ||
| 146 | * Remove the specified resource from storage. | ||
| 147 | * | ||
| 148 | * @param int $id | ||
| 149 | * @return \Illuminate\Http\Response | ||
| 150 | */ | ||
| 151 | public function destroy(Request $request, $id) | ||
| 167 | |||
| 168 | public function clear($id) | ||
| 178 | |||
| 179 | } | ||
| 180 | 
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.