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 |
||
23 | View Code Duplication | class ExternalRequest extends FieldPluginBase implements ContainerFactoryPluginInterface { |
|
24 | use DependencySerializationTrait; |
||
25 | |||
26 | /** |
||
27 | * @var \GuzzleHttp\ClientInterface |
||
28 | */ |
||
29 | protected $httpClient; |
||
30 | |||
31 | /** |
||
32 | * {@inheritdoc} |
||
33 | */ |
||
34 | public static function create( |
||
47 | |||
48 | /** |
||
49 | * {@inheritdoc} |
||
50 | */ |
||
51 | public function __construct( |
||
60 | |||
61 | |||
62 | /** |
||
63 | * {@inheritdoc} |
||
64 | */ |
||
65 | protected function resolveValues($value, array $args, ResolveInfo $info) { |
||
70 | |||
71 | } |
||
72 |