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 |
||
8 | class DumpCommand extends Command |
||
9 | { |
||
10 | /** |
||
11 | * The console command name. |
||
12 | * |
||
13 | * @var string |
||
14 | */ |
||
15 | protected $name = 'module:dump'; |
||
16 | |||
17 | /** |
||
18 | * The console command description. |
||
19 | * |
||
20 | * @var string |
||
21 | */ |
||
22 | protected $description = 'Dump-autoload the specified module or for all module.'; |
||
23 | |||
24 | /** |
||
25 | * Execute the console command. |
||
26 | */ |
||
27 | View Code Duplication | public function handle() |
|
39 | |||
40 | public function dump($module) |
||
50 | |||
51 | /** |
||
52 | * Get the console command arguments. |
||
53 | * |
||
54 | * @return array |
||
55 | */ |
||
56 | protected function getArguments() |
||
62 | } |
||
63 |