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 |
||
27 | View Code Duplication | class GroupResource extends AbstractResource |
|
28 | { |
||
29 | use GetAllTrait; |
||
30 | use GetByIdTrait; |
||
31 | use CreateTrait; |
||
32 | use UpdateTrait; |
||
33 | use DeleteTrait; |
||
34 | |||
35 | /** |
||
36 | * Return connection array ResourceMethod => RequestPathFormat. |
||
37 | * |
||
38 | * @see \Zibios\WrikePhpLibrary\Enum\Api\ResourceMethodEnum |
||
39 | * @see \Zibios\WrikePhpLibrary\Enum\Api\RequestPathFormatEnum |
||
40 | * |
||
41 | * @return array |
||
42 | */ |
||
43 | 5 | protected function getResourceMethodConfiguration(): array |
|
53 | } |
||
54 |