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 |
||
17 | final class FailedRDMAssertionException extends ErrorException implements FailedRDMAssertionExceptionInterface |
||
|
|||
18 | { |
||
19 | |||
20 | /** |
||
21 | * @var string |
||
22 | */ |
||
23 | private $type; |
||
24 | |||
25 | /** |
||
26 | * @var array<mixed> |
||
27 | */ |
||
28 | private $parameters; |
||
29 | |||
30 | 2 | public function __construct(string $message, string $type, array $parameters) |
|
37 | |||
38 | public function getType(): string |
||
42 | |||
43 | public function getParameters(): array |
||
47 | |||
48 | /** |
||
49 | * @param mixed $expectedService |
||
50 | * @param mixed $actualService |
||
51 | */ |
||
52 | 2 | public static function expectedDifferentService( |
|
90 | |||
91 | } |
||
92 |