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 |
||
| 30 | View Code Duplication | class ChannelLeftBridge extends Event implements IdentifiableEventInterface |
|
| 31 | { |
||
| 32 | /** |
||
| 33 | * @var Bridge |
||
| 34 | */ |
||
| 35 | private $bridge; |
||
| 36 | |||
| 37 | /** |
||
| 38 | * @var Channel |
||
| 39 | */ |
||
| 40 | private $channel; |
||
| 41 | |||
| 42 | /** |
||
| 43 | * @return Bridge |
||
| 44 | */ |
||
| 45 | public function getBridge() |
||
| 49 | |||
| 50 | /** |
||
| 51 | * @return Channel |
||
| 52 | */ |
||
| 53 | public function getChannel() |
||
| 57 | |||
| 58 | public function getEventId() |
||
| 62 | |||
| 63 | /** |
||
| 64 | * @param AriClient $client |
||
| 65 | * @param string $response |
||
| 66 | */ |
||
| 67 | public function __construct(AriClient $client, $response) |
||
| 74 | } |
||
| 75 |