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 |
||
29 | View Code Duplication | class PlaybackStarted extends Event implements IdentifiableEventInterface |
|
30 | { |
||
31 | /** |
||
32 | * @var Playback Playback control object |
||
33 | */ |
||
34 | private $playback; |
||
35 | |||
36 | /** |
||
37 | * @return Playback Playback control object |
||
38 | */ |
||
39 | public function getPlayback() |
||
43 | |||
44 | public function getEventId() |
||
48 | |||
49 | /** |
||
50 | * @param AriClient $client |
||
51 | * @param string $response |
||
52 | */ |
||
53 | public function __construct(AriClient $client, $response) |
||
59 | } |
||
60 |