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 |
||
9 | class DatabaseCleanCommand extends Command |
||
10 | { |
||
11 | use DatabaseCommandTrait; |
||
12 | use ConfirmableTrait; |
||
13 | |||
14 | /** |
||
15 | * The name and signature of the console command. |
||
16 | * |
||
17 | * @var string |
||
18 | */ |
||
19 | protected $signature = 'database:clean |
||
20 | {--force : Force the operation to run when in production.} |
||
21 | '; |
||
22 | |||
23 | /** |
||
24 | * The console command description. |
||
25 | * |
||
26 | * @var string |
||
27 | */ |
||
28 | protected $description = 'Database migrate to clean'; |
||
29 | |||
30 | /** |
||
31 | * Execute the console command. |
||
32 | * |
||
33 | * @param \Jumilla\Versionia\Laravel\Migrator $migrator |
||
34 | * |
||
35 | * @return mixed |
||
36 | */ |
||
37 | 4 | public function handle(Migrator $migrator) |
|
55 | } |
||
56 |