Code Duplication    Length = 13-14 lines in 2 locations

src/Plugin/Deriver/PluggableSchemaDeriver.php 2 locations

@@ 184-196 (lines=13) @@
181
   *   The optimized list of data type to type name references.
182
   */
183
  protected function buildTypeReferenceMap(array $types) {
184
    $references = array_reduce(array_keys($types), function ($references, $name) use ($types) {
185
      $current = $types[$name];
186
      $reference = $current['reference'];
187
188
      if (!empty($reference) && (empty($references[$reference]) || $references[$reference]['weight'] < $current['weight'])) {
189
        $references[$reference] = [
190
          'name' => $name,
191
          'weight' => !empty($current['weight']) ? $current['weight'] : 0,
192
        ];
193
      }
194
195
      return $references;
196
    }, []);
197
198
    return array_map(function ($reference) {
199
      return $reference['name'];
@@ 353-366 (lines=14) @@
350
   */
351
  protected function buildMutationMap(MutationPluginManager $manager) {
352
    $definitions = $manager->getDefinitions();
353
    $mutations = array_reduce(array_keys($definitions), function ($carry, $id) use ($definitions) {
354
      $current = $definitions[$id];
355
      $name = $current['name'];
356
357
      if (empty($carry[$name]) || $carry[$name]['weight'] < $current['weight']) {
358
        $carry[$name] = [
359
          'id' => $id,
360
          'class' => $current['class'],
361
          'weight' => !empty($current['weight']) ? $current['weight'] : 0,
362
        ];
363
      }
364
365
      return $carry;
366
    }, []);
367
368
    return array_map(function ($definition) use ($manager) {
369
      $id = $definition['id'];