Code Duplication    Length = 13-14 lines in 2 locations

src/Plugin/GraphQL/Schemas/SchemaPluginBase.php 2 locations

@@ 399-411 (lines=13) @@
396
   * @return array
397
   */
398
  protected function buildTypeReferenceMap(array $types) {
399
    $references = array_reduce(array_keys($types), function ($references, $name) use ($types) {
400
      $current = $types[$name];
401
      $reference = $current['reference'];
402
403
      if (!empty($reference) && (empty($references[$reference]) || $references[$reference]['weight'] < $current['weight'])) {
404
        $references[$reference] = [
405
          'name' => $name,
406
          'weight' => !empty($current['weight']) ? $current['weight'] : 0,
407
        ];
408
      }
409
410
      return $references;
411
    }, []);
412
413
    return array_map(function ($reference) {
414
      return $reference['name'];
@@ 541-554 (lines=14) @@
538
   */
539
  protected function buildMutationMap(MutationPluginManager $manager) {
540
    $definitions = $manager->getDefinitions();
541
    $mutations = array_reduce(array_keys($definitions), function ($carry, $id) use ($definitions) {
542
      $current = $definitions[$id];
543
      $name = $current['name'];
544
545
      if (empty($carry[$name]) || $carry[$name]['weight'] < $current['weight']) {
546
        $carry[$name] = [
547
          'id' => $id,
548
          'class' => $current['class'],
549
          'weight' => !empty($current['weight']) ? $current['weight'] : 0,
550
        ];
551
      }
552
553
      return $carry;
554
    }, []);
555
556
    return array_map(function ($definition) use ($manager) {
557
      $id = $definition['id'];