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 | View Code Duplication | class ChannelConfig |
|
| 9 | { |
||
| 10 | protected $config = []; |
||
| 11 | |||
| 12 | 8 | public function __construct(array $config) |
|
| 17 | |||
| 18 | 8 | protected function validateConfig($config) |
|
| 32 | |||
| 33 | 1 | public function getHandlers() |
|
| 37 | |||
| 38 | 2 | public function getProcessors() |
|
| 42 | |||
| 43 | 2 | public function getName() |
|
| 47 | } |
||
| 48 |