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 |
||
| 14 | class GenerationBench |
||
|
|
|||
| 15 | { |
||
| 16 | /** |
||
| 17 | * @var Router |
||
| 18 | */ |
||
| 19 | protected $router; |
||
| 20 | |||
| 21 | public function benchAssembleStaticNip() |
||
| 28 | |||
| 29 | public function benchAssembleStandardNip() |
||
| 36 | |||
| 37 | public function benchAssembleStaticSymfony() |
||
| 44 | |||
| 45 | public function benchAssembleDynamicSymfony() |
||
| 52 | |||
| 53 | View Code Duplication | public function init() |
|
| 73 | } |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.