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 |
||
19 | class EndpointTest extends PHPUnit_Framework_TestCase |
||
20 | { |
||
21 | /** |
||
22 | * @covers Component\Remote\BurzeDzisNet\apiKey::apikey |
||
23 | */ |
||
24 | public function testapiKey() |
||
29 | |||
30 | /** |
||
31 | * @covers Component\Remote\BurzeDzisNet\Endpoint::wsdl |
||
32 | */ |
||
33 | public function testWsdl() |
||
38 | |||
39 | /** |
||
40 | * @covers Component\Remote\BurzeDzisNet\Endpoint::options |
||
41 | */ |
||
42 | public function testOptions() |
||
49 | |||
50 | /** |
||
51 | * @covers Component\Remote\BurzeDzisNet\Endpoint::client |
||
52 | */ |
||
53 | public function testClient() |
||
61 | |||
62 | /** |
||
63 | * @covers Component\Remote\BurzeDzisNet\Endpoint::client |
||
64 | * |
||
65 | * @expectedException \SoapFault |
||
66 | */ |
||
67 | View Code Duplication | public function testClientInvalidWSDL() |
|
77 | |||
78 | /** |
||
79 | * @covers Component\Remote\BurzeDzisNet\Endpoint::__construct |
||
80 | */ |
||
81 | public function test__construct() |
||
87 | } |
||
88 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.