Code Duplication    Length = 5-8 lines in 2 locations

modules/graphql_core/src/Plugin/GraphQL/Fields/Menu/MenuLinkLinks.php 1 location

@@ 29-36 (lines=8) @@
26
   */
27
  public function resolveValues($value, array $args, ResolveInfo $info) {
28
    if ($value instanceof MenuLinkTreeElement) {
29
      foreach (array_filter($value->subtree, function(MenuLinkTreeElement $item) {
30
        if ($item->link instanceof MenuLinkInterface) {
31
          return $item->link->isEnabled();
32
        }
33
        return TRUE;
34
      }) as $branch) {
35
        yield $branch;
36
      }
37
    }
38
  }
39

modules/graphql_core/src/Plugin/GraphQL/Fields/Menu/MenuLinks.php 1 location

@@ 65-69 (lines=5) @@
62
        ['callable' => 'menu.default_tree_manipulators:generateIndexAndSort'],
63
      ];
64
65
      foreach (array_filter($this->menuLinkTree->transform($tree, $manipulators), function (MenuLinkTreeElement $item) {
66
        return $item->link instanceof MenuLinkInterface && $item->link->isEnabled();
67
      }) as $branch) {
68
        yield $branch;
69
      }
70
    }
71
  }
72