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 |
||
| 8 | class LDAPMemberSyncJob extends AbstractQueuedJob |
||
|
|
|||
| 9 | { |
||
| 10 | /** |
||
| 11 | * If you specify this value in seconds, it tells the completed job to queue another of itself |
||
| 12 | * x seconds ahead of time. |
||
| 13 | * |
||
| 14 | * @var mixed |
||
| 15 | * @config |
||
| 16 | */ |
||
| 17 | private static $regenerate_time = null; |
||
| 18 | |||
| 19 | public function __construct() |
||
| 23 | |||
| 24 | public function getJobType() |
||
| 28 | |||
| 29 | public function getTitle() |
||
| 33 | |||
| 34 | public function getSignature() |
||
| 38 | |||
| 39 | View Code Duplication | public function validateRegenerateTime() |
|
| 48 | |||
| 49 | public function process() |
||
| 64 | } |
||
| 65 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.