Code Duplication    Length = 13-13 lines in 2 locations

src/Plugin/GraphQL/PluggableSchemaBuilder.php 2 locations

@@ 148-160 (lines=13) @@
145
      foreach ($manager->getDefinitions() as $id => $definition) {
146
        $parents = $definition['parents'] ?: ['Root'];
147
148
        foreach ($parents as $parent) {
149
          $placeholder = &$this->fieldMap[$parent][$definition['name']];
150
151
          if (!empty($placeholder)) {
152
            // Do not override if the existing plugin has a higher weight.
153
            $existing = $this->getPluginDefinition(GRAPHQL_FIELD_PLUGIN, $placeholder);
154
            if ($existing['weight'] > $definition['weight']) {
155
              continue;
156
            }
157
          }
158
159
          $placeholder = $id;
160
        }
161
      }
162
    }
163
@@ 177-189 (lines=13) @@
174
175
    $this->mutationMap = [];
176
    foreach ($this->pluginManagers->getPluginManagers(GRAPHQL_MUTATION_PLUGIN) as $manager) {
177
      foreach ($manager->getDefinitions() as $id => $definition) {
178
        $placeholder = &$this->mutationMap[$definition['name']];
179
180
        if (!empty($placeholder)) {
181
          // Do not override if the existing plugin has a higher weight.
182
          $existing = $this->getPluginDefinition(GRAPHQL_MUTATION_PLUGIN, $placeholder);
183
          if ($existing['weight'] > $definition['weight']) {
184
            continue;
185
          }
186
        }
187
188
        $placeholder = $id;
189
      }
190
    }
191
192
    return $this->mutationMap;