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 |
||
| 25 | class EntityQueryEntities extends FieldPluginBase implements ContainerFactoryPluginInterface { |
||
|
|
|||
| 26 | use DependencySerializationTrait; |
||
| 27 | |||
| 28 | /** |
||
| 29 | * The entity buffer service. |
||
| 30 | * |
||
| 31 | * @var \Drupal\graphql\GraphQL\Buffers\EntityBuffer |
||
| 32 | */ |
||
| 33 | protected $entityBuffer; |
||
| 34 | |||
| 35 | /** |
||
| 36 | * {@inheritdoc} |
||
| 37 | */ |
||
| 38 | public function __construct( |
||
| 47 | |||
| 48 | /** |
||
| 49 | * {@inheritdoc} |
||
| 50 | */ |
||
| 51 | public static function create(ContainerInterface $container, array $configuration, $pluginId, $pluginDefinition) { |
||
| 59 | |||
| 60 | /** |
||
| 61 | * {@inheritdoc} |
||
| 62 | */ |
||
| 63 | public function resolveValues($value, array $args, ResolveInfo $info) { |
||
| 83 | |||
| 84 | } |
||
| 85 |