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 |
||
| 14 | View Code Duplication | class TaskManager_DeleteElementAction extends BaseElementAction |
|
| 15 | { |
||
| 16 | /** |
||
| 17 | * Get element action name. |
||
| 18 | * |
||
| 19 | * @return string |
||
| 20 | */ |
||
| 21 | public function getName() |
||
| 25 | |||
| 26 | /** |
||
| 27 | * Delete given task. |
||
| 28 | * |
||
| 29 | * @param ElementCriteriaModel $criteria |
||
| 30 | * |
||
| 31 | * @return bool |
||
| 32 | */ |
||
| 33 | public function performAction(ElementCriteriaModel $criteria) |
||
| 43 | } |
||
| 44 |