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 |
||
16 | class PurchaseRequestTest extends TestCase |
||
17 | { |
||
18 | private $request; |
||
19 | |||
20 | private $purse = '[email protected]'; |
||
21 | private $secret = '22SAD#-78G888'; |
||
22 | private $returnUrl = 'https://www.foodstore.com/success'; |
||
23 | private $cancelUrl = 'https://www.foodstore.com/failure'; |
||
24 | private $notifyUrl = 'https://www.foodstore.com/notify'; |
||
25 | private $description = 'Test Transaction long description'; |
||
26 | private $transactionId = '12345ASD67890sd'; |
||
27 | private $sum = '1.65'; |
||
28 | private $amount = '14.65'; |
||
29 | private $quantity = '1'; |
||
|
|||
30 | private $currency = 'USD'; |
||
31 | private $testMode = true; |
||
32 | |||
33 | View Code Duplication | public function setUp() |
|
52 | |||
53 | View Code Duplication | public function testGetData() |
|
65 | |||
66 | public function testSendData() |
||
72 | } |
||
73 |
This check marks private properties in classes that are never used. Those properties can be removed.