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 |
||
32 | trait HavingTrait |
||
33 | { |
||
34 | use AbstractTrait; |
||
35 | |||
36 | /** |
||
37 | * {@inheritDoc} |
||
38 | */ |
||
39 | public function having( |
||
46 | |||
47 | /** |
||
48 | * {@inheritDoc} |
||
49 | */ |
||
50 | View Code Duplication | public function havingTpl(/*# string */ $template, $col, array $params = []) |
|
63 | |||
64 | /** |
||
65 | * {@inheritDoc} |
||
66 | */ |
||
67 | View Code Duplication | public function havingRaw(/*# string */ $rawString, array $params = []) |
|
80 | |||
81 | /** |
||
82 | * Build HAVING |
||
83 | * |
||
84 | * @param string $prefix |
||
85 | * @param array $settings |
||
86 | * @return string |
||
87 | * @access protected |
||
88 | */ |
||
89 | protected function buildHaving( |
||
95 | |||
96 | // in WhereTrait |
||
97 | abstract protected function buildWhere( |
||
110 | } |
||
111 |