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 |
||
18 | class CompletePurchaseRequestTest extends TestCase |
||
19 | { |
||
20 | private $request; |
||
21 | |||
22 | private $purse = '[email protected]'; |
||
23 | private $secret = '*&^^&$sdf&(23'; |
||
24 | private $hash = '33bfff79d7eeffdca9a9ac7b34a78dfc'; |
||
|
|||
25 | private $description = 'Test Transaction long description'; |
||
26 | private $transactionId = '12345ASD67890sd'; |
||
27 | private $transactionReference = '12345678'; |
||
28 | private $timestamp = '2016-02-02 16:56:56 UTC'; |
||
29 | private $payer = '[email protected]'; |
||
30 | private $amount = '1465.01'; |
||
31 | private $testMode = false; |
||
32 | private $response = 'VERIFIED'; |
||
33 | |||
34 | public function setUp() |
||
64 | |||
65 | View Code Duplication | public function testGetData() |
|
76 | |||
77 | public function testSendData() |
||
83 | } |
||
84 |
This check marks private properties in classes that are never used. Those properties can be removed.