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 ChannelCallerId extends Event implements IdentifiableEventInterface |
|
| 30 | { |
||
| 31 | /** |
||
| 32 | * @var int The integer representation of the Caller Presentation value. |
||
| 33 | */ |
||
| 34 | private $callerPresentation; |
||
| 35 | |||
| 36 | /** |
||
| 37 | * @var string The text representation of the Caller Presentation value. |
||
| 38 | */ |
||
| 39 | private $callerPresentationTxt; |
||
| 40 | |||
| 41 | /** |
||
| 42 | * @var Channel |
||
| 43 | */ |
||
| 44 | private $channel; |
||
| 45 | |||
| 46 | /** |
||
| 47 | * @return int The integer representation of the Caller Presentation value. |
||
| 48 | */ |
||
| 49 | public function getCallerPresentation() |
||
| 53 | |||
| 54 | /** |
||
| 55 | * @return string The text representation of the Caller Presentation value. |
||
| 56 | */ |
||
| 57 | public function getCallerPresentationTxt() |
||
| 61 | |||
| 62 | /** |
||
| 63 | * @return Channel |
||
| 64 | */ |
||
| 65 | public function getChannel() |
||
| 69 | |||
| 70 | public function getEventId() |
||
| 74 | |||
| 75 | /** |
||
| 76 | * @param AriClient $client |
||
| 77 | * @param string $response |
||
| 78 | */ |
||
| 79 | public function __construct(AriClient $client, $response) |
||
| 87 | } |
||
| 88 |