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 |
||
9 | View Code Duplication | class RunnableDelete extends Delete implements DDLPreparable { |
|
10 | use CreateDDLRunnable; |
||
11 | |||
12 | /** |
||
13 | * @param MySQL $db |
||
14 | * @param array $options |
||
15 | */ |
||
16 | public function __construct(MySQL $db, array $options = []) { |
||
19 | |||
20 | /** |
||
21 | * @param array $params |
||
22 | * @return int |
||
23 | */ |
||
24 | public function run(array $params = array()) { |
||
27 | |||
28 | /** |
||
29 | * @return DDLRunnable |
||
30 | */ |
||
31 | public function prepare() { |
||
34 | } |
||
35 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.