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 |
||
20 | class LDAPAllSyncJob extends AbstractQueuedJob |
||
21 | { |
||
22 | /** |
||
23 | * If you specify this value in seconds, it tells the completed job to queue another of itself |
||
24 | * x seconds ahead of time. |
||
25 | * |
||
26 | * @var mixed |
||
27 | * @config |
||
28 | */ |
||
29 | private static $regenerate_time = null; |
||
|
|||
30 | |||
31 | public function __construct() |
||
35 | |||
36 | /** |
||
37 | * @return string |
||
38 | */ |
||
39 | public function getJobType() |
||
43 | |||
44 | /** |
||
45 | * @return string |
||
46 | */ |
||
47 | public function getTitle() |
||
51 | |||
52 | /** |
||
53 | * @return string |
||
54 | */ |
||
55 | public function getSignature() |
||
59 | |||
60 | /** |
||
61 | * @throws Exception |
||
62 | */ |
||
63 | View Code Duplication | public function validateRegenerateTime() |
|
72 | |||
73 | /** |
||
74 | * {@inheritDoc} |
||
75 | */ |
||
76 | public function process() |
||
94 | } |
||
95 |
This check marks private properties in classes that are never used. Those properties can be removed.