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 |
||
14 | View Code Duplication | class ShippingTest extends \PHPUnit\Framework\TestCase |
|
15 | { |
||
16 | protected $shippingInput = [ |
||
17 | 'id' => 1, |
||
18 | 'name' => 'National postal services', |
||
19 | 'description' => '', |
||
20 | 'cost' => 3.4 |
||
21 | ]; |
||
22 | |||
23 | public function testCreateObject() |
||
34 | |||
35 | public function testSetCost() |
||
42 | |||
43 | public function testSetPriceFormat() |
||
56 | } |
||
57 |