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 |
||
| 14 | final class Exchange implements ExchangeInterface |
||
| 15 | { |
||
| 16 | private $connection; |
||
| 17 | private $channel; |
||
| 18 | |||
| 19 | 3 | public function __construct(Connection $connection, Channel $channel) |
|
| 24 | |||
| 25 | 1 | View Code Duplication | public function declare(Declaration $command): ExchangeInterface |
| 40 | |||
| 41 | 1 | View Code Duplication | public function delete(Deletion $command): ExchangeInterface |
| 56 | } |
||
| 57 |