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 |
||
13 | class GroupProcessManagerTest extends Test |
||
14 | { |
||
15 | /** |
||
16 | * @var GroupProcessManager |
||
17 | */ |
||
18 | protected $manager; |
||
19 | |||
20 | /** |
||
21 | * @inheritdoc |
||
22 | */ |
||
23 | public function setUp() |
||
31 | |||
32 | /** |
||
33 | * @test |
||
34 | */ |
||
35 | public function groupsExecuteInPredictableOrder() |
||
79 | |||
80 | /** |
||
81 | * @param string $name |
||
82 | */ |
||
83 | protected function unlink($name) |
||
89 | |||
90 | /** |
||
91 | * @param string $name |
||
92 | * |
||
93 | * @return bool |
||
94 | */ |
||
95 | protected function exists($name) |
||
99 | |||
100 | /** |
||
101 | * @param string $name |
||
102 | */ |
||
103 | View Code Duplication | public static function dawdle($name) |
|
113 | } |
||
114 |