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 |
||
35 | class EndpointBuilder implements |
||
|
|||
36 | EndpointBuilderInterface, |
||
37 | PermissionAwareBuilderInterface, |
||
38 | NamedEndpointBuilderInterface, |
||
39 | MultitenantEndpointBuilderInterface, |
||
40 | InOutControlBuilderInterface, |
||
41 | MiddlewareBuilderInterface, |
||
42 | ExamplesAwareBuilderInterface, |
||
43 | DescriptionBuilderInterface |
||
44 | { |
||
45 | use PermissionAwareBuilderTrait; |
||
46 | use NamedEndpointBuilderTrait; |
||
47 | use MultitenantEndpointBuilderTrait; |
||
48 | use InOutControlBuilderTrait; |
||
49 | use MiddlewareBuilderTrait; |
||
50 | use ExamplesAwareBuilderTrait; |
||
51 | use DescriptionBuilderTrait; |
||
52 | |||
53 | /** |
||
54 | * @return Closure[] |
||
55 | */ |
||
56 | protected function getBuildersList(): array |
||
68 | |||
69 | /** |
||
70 | * @inheritDoc |
||
71 | */ |
||
72 | View Code Duplication | public function build() |
|
83 | } |
||
84 |