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 |
||
13 | { |
||
14 | /** |
||
15 | * @var Identity |
||
16 | */ |
||
17 | private $userId; |
||
18 | |||
19 | /** |
||
20 | * @var string |
||
21 | */ |
||
22 | private $resetToken; |
||
23 | |||
24 | public function __construct(Identity $userId, string $resetToken) |
||
29 | |||
30 | /** |
||
31 | * Getter de resetToken |
||
32 | * |
||
33 | * @return string |
||
34 | */ |
||
35 | public function getResetToken() |
||
39 | |||
40 | /** |
||
41 | * @return Identity |
||
42 | */ |
||
43 | public function getUserId(): Identity |
||
47 | } |
||
48 |