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 |
||
| 7 | class MakeUserCommand extends Command |
||
| 8 | { |
||
| 9 | /** |
||
| 10 | * The console command name. |
||
| 11 | * |
||
| 12 | * @var string |
||
| 13 | */ |
||
| 14 | protected $name = 'make:user'; |
||
| 15 | |||
| 16 | /** |
||
| 17 | * The console command description. |
||
| 18 | * |
||
| 19 | * @var string |
||
| 20 | */ |
||
| 21 | protected $description = 'Creates a new user'; |
||
| 22 | |||
| 23 | /** |
||
| 24 | * __construct. |
||
| 25 | */ |
||
| 26 | public function __construct() |
||
| 30 | |||
| 31 | /** |
||
| 32 | * Run the command. |
||
| 33 | */ |
||
| 34 | public function fire() |
||
| 56 | } |
||
| 57 |