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 |
||
10 | class Processes |
||
11 | { |
||
12 | /** |
||
13 | * @var ChunkResults |
||
14 | */ |
||
15 | private $chunkResults; |
||
16 | |||
17 | /** |
||
18 | * @var OutputInterface |
||
19 | */ |
||
20 | private $output; |
||
21 | |||
22 | /** |
||
23 | * @var int |
||
24 | */ |
||
25 | private $numParallelProcesses; |
||
26 | |||
27 | /** |
||
28 | * @var bool |
||
29 | */ |
||
30 | private $verbose; |
||
31 | |||
32 | /** |
||
33 | * @var bool |
||
34 | */ |
||
35 | private $stop; |
||
36 | |||
37 | /** |
||
38 | * @var array |
||
39 | */ |
||
40 | private $processes = []; |
||
41 | |||
42 | 1 | public function __construct( |
|
55 | |||
56 | public function addProcess(Process $process) |
||
60 | |||
61 | public function wait() |
||
101 | } |
||
102 |