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 |
||
| 18 | View Code Duplication | final class RequestPasswordResettingAction |
|
| 19 | { |
||
| 20 | /** |
||
| 21 | * @var ViewHandlerInterface |
||
| 22 | */ |
||
| 23 | private $viewHandler; |
||
| 24 | |||
| 25 | /** |
||
| 26 | * @var CommandBus |
||
| 27 | */ |
||
| 28 | private $bus; |
||
| 29 | |||
| 30 | public function __construct( |
||
| 37 | |||
| 38 | public function __invoke(Request $request): Response |
||
| 45 | } |
||
| 46 |