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 |
||
| 11 | class PropertyHandler extends Action |
||
| 12 | { |
||
| 13 | public $modelName = null; |
||
| 14 | public $objectId = null; |
||
| 15 | |||
| 16 | /** |
||
| 17 | * @throws yii\web\ServerErrorHttpException |
||
| 18 | */ |
||
| 19 | View Code Duplication | public function init() |
|
| 35 | |||
| 36 | /** |
||
| 37 | * @param null $property_id |
||
| 38 | * @param null $handler_action |
||
| 39 | * @param null $model_id |
||
| 40 | * @return mixed |
||
| 41 | */ |
||
| 42 | public function run($property_id = null, $handler_action = null, $model_id = null) |
||
| 65 | } |
||
| 66 |