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 Propaganistas\LaravelIntl; |
||
9 | class IntlServiceProvider extends ServiceProvider |
||
10 | { |
||
11 | /** |
||
12 | * Register the service provider. |
||
13 | * |
||
14 | * @return void |
||
15 | */ |
||
16 | 147 | public function register() |
|
24 | |||
25 | /** |
||
26 | * Bootstrap the application services. |
||
27 | * |
||
28 | * @return void |
||
29 | */ |
||
30 | 147 | public function boot() |
|
38 | |||
39 | /** |
||
40 | * Register the country repository. |
||
41 | * |
||
42 | * @return void |
||
43 | */ |
||
44 | 147 | View Code Duplication | protected function registerCountry() |
54 | |||
55 | /** |
||
56 | * Register the currency repository. |
||
57 | * |
||
58 | * @return void |
||
59 | */ |
||
60 | 147 | View Code Duplication | protected function registerCurrency() |
70 | |||
71 | /** |
||
72 | * Register the language repository. |
||
73 | * |
||
74 | * @return void |
||
75 | */ |
||
76 | 147 | View Code Duplication | protected function registerLanguage() |
86 | |||
87 | /** |
||
88 | * Register the number repository. |
||
89 | * |
||
90 | * @return void |
||
91 | */ |
||
92 | 147 | View Code Duplication | protected function registerNumber() |
102 | |||
103 | /** |
||
104 | * Register the date handler. |
||
105 | * |
||
106 | * @return void |
||
107 | */ |
||
108 | 147 | protected function registerDate() |
|
114 | |||
115 | /** |
||
116 | * Set locales on sub-libraries. |
||
117 | * |
||
118 | * @throws \Punic\Exception\InvalidLocale |
||
119 | */ |
||
120 | 147 | protected function setLocale() |
|
131 | } |
||
132 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.