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 |
||
| 16 | class JsonResponseHandler extends Handler |
||
| 17 | { |
||
| 18 | /** |
||
| 19 | * @var bool |
||
| 20 | */ |
||
| 21 | private $returnFrames = false; |
||
| 22 | |||
| 23 | /** |
||
| 24 | * @param bool|null $returnFrames |
||
| 25 | * @return bool|$this |
||
| 26 | */ |
||
| 27 | 2 | View Code Duplication | public function addTraceToOutput($returnFrames = null) |
| 36 | |||
| 37 | /** |
||
| 38 | * @return int |
||
| 39 | */ |
||
| 40 | 2 | public function handle() |
|
| 57 | } |
||
| 58 |