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 |
||
7 | View Code Duplication | class Rollup extends AbstractGroupBy implements ExprInterface |
|
8 | { |
||
9 | /** |
||
10 | * @var array |
||
11 | */ |
||
12 | protected $fields; |
||
13 | |||
14 | 1 | public function __construct(array $fields) |
|
15 | { |
||
16 | 1 | $this->fields = $fields; |
|
17 | 1 | } |
|
18 | |||
19 | /** |
||
20 | * {@inheritdoc} |
||
21 | */ |
||
22 | 1 | protected function getGroupByPart(): string |
|
26 | } |
||
27 |