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 |
||
| 12 | View Code Duplication | abstract class BaseUser extends BaseController |
|
| 13 | { |
||
| 14 | /** |
||
| 15 | * @param Container $container |
||
| 16 | */ |
||
| 17 | public function __construct(Container $container) |
||
| 22 | |||
| 23 | /** |
||
| 24 | * @return UserService |
||
| 25 | */ |
||
| 26 | protected function getUserService() |
||
| 32 | |||
| 33 | /** |
||
| 34 | * @return array |
||
| 35 | */ |
||
| 36 | protected function getInput() |
||
| 40 | } |
||
| 41 |