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 |
||
| 48 | class RaCandidate implements JsonSerializable |
||
|
|
|||
| 49 | { |
||
| 50 | /** |
||
| 51 | * @ORM\Id |
||
| 52 | * @ORM\Column(length=36) |
||
| 53 | * |
||
| 54 | * @var string |
||
| 55 | */ |
||
| 56 | public $identityId; |
||
| 57 | |||
| 58 | /** |
||
| 59 | * @ORM\Id |
||
| 60 | * @ORM\Column(type="institution") |
||
| 61 | * |
||
| 62 | * @var Institution |
||
| 63 | */ |
||
| 64 | public $raInstitution; |
||
| 65 | |||
| 66 | /** |
||
| 67 | * @ORM\Column(type="institution") |
||
| 68 | * |
||
| 69 | * @var \Surfnet\Stepup\Identity\Value\Institution |
||
| 70 | */ |
||
| 71 | public $institution; |
||
| 72 | |||
| 73 | /** |
||
| 74 | * @ORM\Column(type="stepup_name_id") |
||
| 75 | * |
||
| 76 | * @var \Surfnet\Stepup\Identity\Value\NameId |
||
| 77 | */ |
||
| 78 | public $nameId; |
||
| 79 | |||
| 80 | /** |
||
| 81 | * @ORM\Column(type="stepup_common_name") |
||
| 82 | * |
||
| 83 | * @var \Surfnet\Stepup\Identity\Value\CommonName |
||
| 84 | */ |
||
| 85 | public $commonName; |
||
| 86 | |||
| 87 | /** |
||
| 88 | * @ORM\Column(type="stepup_email") |
||
| 89 | * |
||
| 90 | * @var \Surfnet\Stepup\Identity\Value\Email |
||
| 91 | */ |
||
| 92 | public $email; |
||
| 93 | |||
| 94 | private function __construct() {} |
||
| 95 | |||
| 96 | public static function nominate( |
||
| 114 | |||
| 115 | View Code Duplication | public function jsonSerialize() |
|
| 126 | } |
||
| 127 |