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 |
||
| 25 | class PgNumber implements ConverterInterface |
||
| 26 | { |
||
| 27 | /** |
||
| 28 | * fromPg |
||
| 29 | * |
||
| 30 | * @see ConverterInterface |
||
| 31 | */ |
||
| 32 | View Code Duplication | public function fromPg($data, $type, Session $session) |
|
| 42 | |||
| 43 | /** |
||
| 44 | * toPg |
||
| 45 | * |
||
| 46 | * @see ConverterInterface |
||
| 47 | */ |
||
| 48 | View Code Duplication | public function toPg($data, $type, Session $session) |
|
| 56 | |||
| 57 | /** |
||
| 58 | * toPgStandardFormat |
||
| 59 | * |
||
| 60 | * @see ConverterInterface |
||
| 61 | */ |
||
| 62 | public function toPgStandardFormat($data, $type, Session $session) |
||
| 70 | } |
||
| 71 |