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 |
||
9 | class LDAPAllSyncJob extends AbstractQueuedJob |
||
|
|||
10 | { |
||
11 | /** |
||
12 | * If you specify this value in seconds, it tells the completed job to queue another of itself |
||
13 | * x seconds ahead of time. |
||
14 | * |
||
15 | * @var mixed |
||
16 | * @config |
||
17 | */ |
||
18 | private static $regenerate_time = null; |
||
19 | |||
20 | public function __construct() |
||
24 | |||
25 | public function getJobType() |
||
29 | |||
30 | public function getTitle() |
||
34 | |||
35 | public function getSignature() |
||
39 | |||
40 | View Code Duplication | public function validateRegenerateTime() |
|
49 | |||
50 | public function process() |
||
68 | } |
||
69 |
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.