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 |
||
| 36 | class RaCandidate implements JsonSerializable |
||
|
|
|||
| 37 | { |
||
| 38 | /** |
||
| 39 | * @ORM\Id |
||
| 40 | * @ORM\Column(length=36) |
||
| 41 | * |
||
| 42 | * @var string |
||
| 43 | */ |
||
| 44 | public $identityId; |
||
| 45 | |||
| 46 | /** |
||
| 47 | * @ORM\Id |
||
| 48 | * @ORM\Column(type="institution") |
||
| 49 | * |
||
| 50 | * @var Institution |
||
| 51 | */ |
||
| 52 | public $raInstitution; |
||
| 53 | |||
| 54 | /** |
||
| 55 | * @ORM\Column(type="institution") |
||
| 56 | * |
||
| 57 | * @var \Surfnet\Stepup\Identity\Value\Institution |
||
| 58 | */ |
||
| 59 | public $institution; |
||
| 60 | |||
| 61 | /** |
||
| 62 | * @ORM\Column(type="stepup_name_id") |
||
| 63 | * |
||
| 64 | * @var \Surfnet\Stepup\Identity\Value\NameId |
||
| 65 | */ |
||
| 66 | public $nameId; |
||
| 67 | |||
| 68 | /** |
||
| 69 | * @ORM\Column(type="stepup_common_name") |
||
| 70 | * |
||
| 71 | * @var \Surfnet\Stepup\Identity\Value\CommonName |
||
| 72 | */ |
||
| 73 | public $commonName; |
||
| 74 | |||
| 75 | /** |
||
| 76 | * @ORM\Column(type="stepup_email") |
||
| 77 | * |
||
| 78 | * @var \Surfnet\Stepup\Identity\Value\Email |
||
| 79 | */ |
||
| 80 | public $email; |
||
| 81 | |||
| 82 | private function __construct() |
||
| 83 | { |
||
| 84 | } |
||
| 85 | |||
| 86 | public static function nominate( |
||
| 104 | |||
| 105 | View Code Duplication | public function jsonSerialize() |
|
| 116 | } |
||
| 117 |