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 |
||
| 26 | View Code Duplication | class DialplanCep extends Response |
|
| 27 | { |
||
| 28 | /** |
||
| 29 | * @var string Context in the dialplan |
||
| 30 | */ |
||
| 31 | private $context; |
||
| 32 | |||
| 33 | /** |
||
| 34 | * @var string Extension in the dialplan |
||
| 35 | */ |
||
| 36 | private $exten; |
||
| 37 | |||
| 38 | /** |
||
| 39 | * @var int Priority in the dialplan |
||
| 40 | */ |
||
| 41 | private $priority; |
||
| 42 | |||
| 43 | /** |
||
| 44 | * @return string Context in the dialplan |
||
| 45 | */ |
||
| 46 | public function getContext() |
||
| 50 | |||
| 51 | /** |
||
| 52 | * @return string Extension in the dialplan |
||
| 53 | */ |
||
| 54 | public function getExten() |
||
| 58 | |||
| 59 | /** |
||
| 60 | * @return int Priority in the dialplan |
||
| 61 | */ |
||
| 62 | public function getPriority() |
||
| 66 | |||
| 67 | /** |
||
| 68 | * @param string $response |
||
| 69 | */ |
||
| 70 | public function __construct($response) |
||
| 78 | |||
| 79 | } |
||
| 80 |