Code Duplication    Length = 15-15 lines in 2 locations

modules/graphql_core/src/Plugin/Deriver/Fields/EntityQueryDeriver.php 1 location

@@ 56-70 (lines=15) @@
53
  /**
54
   * {@inheritdoc}
55
   */
56
  public function getDerivativeDefinitions($basePluginDefinition) {
57
    foreach ($this->entityTypeManager->getDefinitions() as $id => $type) {
58
      if ($type instanceof ContentEntityTypeInterface) {
59
        $derivative = [
60
          'name' => StringHelper::propCase($id, 'query'),
61
          'description' => $this->t("Loads '@type' entities.", ['@type' => $type->getLabel()]),
62
          'entity_type' => $id,
63
        ] + $basePluginDefinition;
64
65
        $this->derivatives[$id] = $derivative;
66
      }
67
    }
68
69
    return parent::getDerivativeDefinitions($basePluginDefinition);
70
  }
71
72
}
73

modules/graphql_core/src/Plugin/Deriver/Interfaces/EntityTypeDeriver.php 1 location

@@ 48-62 (lines=15) @@
45
  /**
46
   * {@inheritdoc}
47
   */
48
  public function getDerivativeDefinitions($basePluginDefinition) {
49
    $this->derivatives = [];
50
    foreach ($this->entityTypeManager->getDefinitions() as $typeId => $type) {
51
      if ($type instanceof ContentEntityTypeInterface) {
52
        $this->derivatives[$typeId] = [
53
          'name' => StringHelper::camelCase($typeId),
54
          'description' => $this->t("The '@type' entity type.", [
55
            '@type' => $type->getLabel(),
56
          ]),
57
          'type' => "entity:$typeId",
58
        ] + $basePluginDefinition;
59
      }
60
    }
61
    return parent::getDerivativeDefinitions($basePluginDefinition);
62
  }
63
64
}
65