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 ChannelHangupRequest extends Event implements IdentifiableEventInterface |
|
31 | { |
||
32 | /** |
||
33 | * @var int (optional) - Integer representation of the cause of the hangup. |
||
34 | */ |
||
35 | private $cause; |
||
36 | |||
37 | /** |
||
38 | * @var \phparia\Resources\Channel The channel on which the hangup was requested. |
||
39 | */ |
||
40 | private $channel; |
||
41 | |||
42 | /** |
||
43 | * @var boolean (optional) - Whether the hangup request was a soft hangup request. |
||
44 | */ |
||
45 | private $soft; |
||
46 | |||
47 | /** |
||
48 | * @return int |
||
49 | */ |
||
50 | public function getCause() |
||
54 | |||
55 | /** |
||
56 | * @return Channel |
||
57 | */ |
||
58 | public function getChannel() |
||
62 | |||
63 | /** |
||
64 | * @return boolean |
||
65 | */ |
||
66 | public function getSoft() |
||
70 | |||
71 | public function getEventId() |
||
75 | |||
76 | /** |
||
77 | * @param AriClient $client |
||
78 | * @param string $response |
||
79 | */ |
||
80 | public function __construct(AriClient $client, $response) |
||
88 | } |
||
89 |