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 |
||
| 15 | class LockedBehavior extends Behavior |
||
| 16 | { |
||
| 17 | public $lockedAttribute; |
||
| 18 | |||
| 19 | public $valueLock = true; |
||
| 20 | public $valueUnlock = false; |
||
| 21 | |||
| 22 | public function events() |
||
| 28 | |||
| 29 | public function getDefaultValue($event) |
||
| 38 | |||
| 39 | View Code Duplication | public function lock() |
|
| 49 | |||
| 50 | View Code Duplication | public function unlock() |
|
| 61 | } |
||
| 62 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.