Code Duplication    Length = 13-14 lines in 2 locations

src/Plugin/Deriver/PluggableSchemaDeriver.php 2 locations

@@ 188-200 (lines=13) @@
185
   *   The optimized list of data type to type name references.
186
   */
187
  protected function buildTypeReferenceMap(array $types) {
188
    $references = array_reduce(array_keys($types), function ($references, $name) use ($types) {
189
      $current = $types[$name];
190
      $reference = $current['reference'];
191
192
      if (!empty($reference) && (empty($references[$reference]) || $references[$reference]['weight'] < $current['weight'])) {
193
        $references[$reference] = [
194
          'name' => $name,
195
          'weight' => !empty($current['weight']) ? $current['weight'] : 0,
196
        ];
197
      }
198
199
      return $references;
200
    }, []);
201
202
    return array_map(function ($reference) {
203
      return $reference['name'];
@@ 379-392 (lines=14) @@
376
   */
377
  protected function buildMutationMap(MutationPluginManager $manager) {
378
    $definitions = $manager->getDefinitions();
379
    $mutations = array_reduce(array_keys($definitions), function ($carry, $id) use ($definitions) {
380
      $current = $definitions[$id];
381
      $name = $current['name'];
382
383
      if (empty($carry[$name]) || $carry[$name]['weight'] < $current['weight']) {
384
        $carry[$name] = [
385
          'id' => $id,
386
          'class' => $current['class'],
387
          'weight' => !empty($current['weight']) ? $current['weight'] : 0,
388
        ];
389
      }
390
391
      return $carry;
392
    }, []);
393
394
    return array_map(function ($definition) use ($manager) {
395
      $id = $definition['id'];