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 | final class Row implements RowInterface |
|
| 10 | { |
||
| 11 | private $identifier; |
||
| 12 | private $cells; |
||
| 13 | |||
| 14 | 14 | public function __construct($identifier, MapInterface $cells) |
|
| 27 | |||
| 28 | /** |
||
| 29 | * {@inheritdoc} |
||
| 30 | */ |
||
| 31 | 5 | public function identifier() |
|
| 35 | |||
| 36 | /** |
||
| 37 | * {@inheritdoc} |
||
| 38 | */ |
||
| 39 | 12 | public function cells(): MapInterface |
|
| 43 | } |
||
| 44 |