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 |
||
| 12 | class ExportSpec extends ObjectBehavior |
||
| 13 | { |
||
| 14 | public function let(Client $client, HttpClient $http) |
||
| 21 | |||
| 22 | public function it_should_be_an_api() |
||
| 26 | |||
| 27 | View Code Duplication | public function it_builds_last_translations(HttpClient $http, Request $request, Response $response) |
|
| 34 | |||
| 35 | View Code Duplication | public function it_skips_build_if_less_than_half_an_hour(HttpClient $http, Request $request, Response $response) |
|
| 42 | } |
||
| 43 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.