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 |
||
| 3 | class VisitorCest |
||
| 4 | { |
||
| 5 | |||
| 6 | public function _before(AcceptanceTester $I) |
||
| 18 | |||
| 19 | public function _after(AcceptanceTester $I) |
||
| 22 | |||
| 23 | // tests |
||
| 24 | View Code Duplication | public function i_should_check_visitor(AcceptanceTester $I) |
|
| 35 | |||
| 36 | View Code Duplication | public function i_should_uncheck_visitor(AcceptanceTester $I) |
|
| 47 | |||
| 48 | } |
||
| 49 |
This check marks parameter names that have not been written in camelCase.
In camelCase names are written without any punctuation, the start of each new word being marked by a capital letter. Thus the name database connection string becomes
databaseConnectionString.