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 ChannelTalkingFinished extends Event implements IdentifiableEventInterface |
|
30 | { |
||
31 | /** |
||
32 | * @var Channel The channel on which talking completed. |
||
33 | */ |
||
34 | private $channel; |
||
35 | |||
36 | /** |
||
37 | * @var int The length of time, in milliseconds, that talking was detected on the channel |
||
38 | */ |
||
39 | private $duration; |
||
40 | |||
41 | /** |
||
42 | * @return Channel The channel on which talking completed. |
||
43 | */ |
||
44 | public function getChannel() |
||
48 | |||
49 | /** |
||
50 | * @return int The length of time, in milliseconds, that talking was detected on the channel |
||
51 | */ |
||
52 | public function getDuration() |
||
56 | |||
57 | public function getEventId() |
||
61 | |||
62 | /** |
||
63 | * @param AriClient $client |
||
64 | * @param string $response |
||
65 | */ |
||
66 | public function __construct(AriClient $client, $response) |
||
73 | } |
||
74 |