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 PurchaseResponseTest extends TestCase |
||
| 17 | { |
||
| 18 | private $request; |
||
| 19 | |||
| 20 | private $purse = 'ec12345'; |
||
| 21 | private $secret = '12()&*&+_)?><'; |
||
| 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() |
|
| 50 | |||
| 51 | public function testSuccess() |
||
| 70 | } |
||
| 71 |
This check marks private properties in classes that are never used. Those properties can be removed.