Code Duplication    Length = 13-14 lines in 2 locations

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

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