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 |
||
| 28 | View Code Duplication | class TipoConducta extends Tipo |
|
| 29 | { |
||
| 30 | /** |
||
| 31 | * @ORM\ManyToOne(targetEntity="CategoriaConducta") |
||
| 32 | * @ORM\JoinColumn(nullable=false) |
||
| 33 | */ |
||
| 34 | protected $categoria; |
||
| 35 | |||
| 36 | /** |
||
| 37 | * Set categoria |
||
| 38 | * |
||
| 39 | * @param CategoriaConducta $categoria |
||
| 40 | * @return self |
||
| 41 | */ |
||
| 42 | public function setCategoria(CategoriaConducta $categoria = null) |
||
| 48 | |||
| 49 | /** |
||
| 50 | * Get categoria |
||
| 51 | * |
||
| 52 | * @return CategoriaConducta |
||
| 53 | */ |
||
| 54 | public function getCategoria() |
||
| 58 | |||
| 59 | public function __toString() |
||
| 63 | } |
||
| 64 |