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 |
||
| 15 | View Code Duplication | final class RequestPasswordResettingAction |
|
| 16 | { |
||
| 17 | /** |
||
| 18 | * @var ViewHandlerInterface |
||
| 19 | */ |
||
| 20 | private $viewHandler; |
||
| 21 | |||
| 22 | /** |
||
| 23 | * @var CommandBus |
||
| 24 | */ |
||
| 25 | private $bus; |
||
| 26 | |||
| 27 | public function __construct( |
||
| 34 | |||
| 35 | public function __invoke(Request $request): Response |
||
| 42 | } |
||
| 43 |