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 |
||
| 8 | View Code Duplication | class ChmodOperation implements OperationInterface |
|
| 9 | { |
||
| 10 | /** |
||
| 11 | * @var string |
||
| 12 | */ |
||
| 13 | protected $relativePath; |
||
| 14 | |||
| 15 | /** |
||
| 16 | * @var int |
||
| 17 | */ |
||
| 18 | protected $mode; |
||
| 19 | |||
| 20 | public function __construct(string $relativePath, int $mode) |
||
| 25 | |||
| 26 | public function execute(string $localBasePath, FileReader $fileReader, VaultLayoutInterface $vaultLayout): bool |
||
| 32 | |||
| 33 | /** |
||
| 34 | * @codeCoverageIgnore |
||
| 35 | */ |
||
| 36 | public function __toString(): string |
||
| 40 | } |
||
| 41 |