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