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 |
||
| 21 | class ForgeCommand extends AbstractCommand |
||
| 22 | { |
||
| 23 | /** |
||
| 24 | * AbstractCommand constructor. |
||
| 25 | * |
||
| 26 | * @param Payload $payload |
||
| 27 | * @param RealTimeClient $client |
||
| 28 | * @param array|null $configuration |
||
| 29 | */ |
||
| 30 | 10 | View Code Duplication | public function __construct(Payload $payload, RealTimeClient $client, array $configuration = null) |
| 39 | |||
| 40 | /** |
||
| 41 | * process show. |
||
| 42 | * |
||
| 43 | * @return string |
||
| 44 | */ |
||
| 45 | 9 | protected function processShow() : string |
|
| 62 | } |
||
| 63 |