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 |
||
| 10 | class MigrateRefreshCommand extends Command |
||
| 11 | { |
||
| 12 | use ModuleCommandTrait; |
||
| 13 | |||
| 14 | /** |
||
| 15 | * The console command name. |
||
| 16 | * |
||
| 17 | * @var string |
||
| 18 | */ |
||
| 19 | protected $name = 'module:migrate-refresh'; |
||
| 20 | |||
| 21 | /** |
||
| 22 | * The console command description. |
||
| 23 | * |
||
| 24 | * @var string |
||
| 25 | */ |
||
| 26 | protected $description = 'Rollback & re-migrate the modules migrations.'; |
||
| 27 | |||
| 28 | /** |
||
| 29 | * Execute the console command. |
||
| 30 | */ |
||
| 31 | public function handle() : int |
||
| 61 | |||
| 62 | /** |
||
| 63 | * Get the console command arguments. |
||
| 64 | * |
||
| 65 | * @return array |
||
| 66 | */ |
||
| 67 | 128 | protected function getArguments() |
|
| 73 | |||
| 74 | /** |
||
| 75 | * Get the console command options. |
||
| 76 | * |
||
| 77 | * @return array |
||
| 78 | */ |
||
| 79 | 128 | View Code Duplication | protected function getOptions() |
| 87 | |||
| 88 | public function getModuleName() |
||
| 100 | } |
||
| 101 |