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 | |||
11 | View Code Duplication | class CreateCoursesTable extends Migration |
|
12 | { |
||
13 | /** |
||
14 | * Run the migrations. |
||
15 | * |
||
16 | * @return void |
||
17 | */ |
||
18 | public function up() |
||
32 | /** |
||
33 | * Reverse the migrations. |
||
34 | * |
||
35 | * @return void |
||
36 | */ |
||
37 | public function down() |
||
42 | } |