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 $amount = '14.65'; |
||
| 28 | private $quantity = '1'; |
||
| 29 | private $currency = 'USD'; |
||
| 30 | private $testMode = true; |
||
| 31 | |||
| 32 | View Code Duplication | public function setUp() |
|
| 49 | |||
| 50 | View Code Duplication | public function testGetData() |
|
| 61 | |||
| 62 | public function testSendData() |
||
| 68 | } |
||
| 69 |
This check marks private properties in classes that are never used. Those properties can be removed.