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 namespace Distilleries\Messenger; |
||
7 | class MessengerLumenServiceProvider extends ServiceProvider { |
||
8 | |||
9 | |||
10 | protected $package = 'messenger'; |
||
11 | protected $namespace = 'Distilleries\Messenger\Http\Controllers'; |
||
12 | |||
13 | |||
14 | public function boot() |
||
20 | |||
21 | /** |
||
22 | * Register the service provider. |
||
23 | * |
||
24 | * @return void |
||
25 | */ |
||
26 | View Code Duplication | public function register() |
|
41 | |||
42 | /** |
||
43 | * Get the services provided by the provider. |
||
44 | * |
||
45 | * @return string[] |
||
46 | */ |
||
47 | public function provides() |
||
51 | |||
52 | |||
53 | public function alias() { |
||
59 | |||
60 | /** |
||
61 | * Define the routes for the application. |
||
62 | * |
||
63 | * @return void |
||
64 | */ |
||
65 | public function map() |
||
72 | } |