Code Duplication    Length = 13-17 lines in 2 locations

modules/graphql_core/src/Plugin/GraphQL/Fields/EntityQuery/EntityQuery.php 1 location

@@ 93-105 (lines=13) @@
90
   * @return \Drupal\graphql\Plugin\GraphQL\PluggableSchemaBuilderInterface|null
91
   *   The corresponding plugin instance for this edge.
92
   */
93
  protected function getSchemaBuilder(ResolveInfo $info) {
94
    $schema = isset($info) ? $info->getExecutionContext()->getSchema() : NULL;
95
    if (!$schema instanceof Schema) {
96
      return NULL;
97
    }
98
99
    $schemaPlugin = $schema->getSchemaPlugin();
100
    if (!$schemaPlugin instanceof PluggableSchemaPluginInterface) {
101
      return NULL;
102
    }
103
104
    return $schemaPlugin->getSchemaBuilder();
105
  }
106
107
  /**
108
   * {@inheritdoc}

src/GraphQL/CacheableEdgeTrait.php 1 location

@@ 47-63 (lines=17) @@
44
   * @return \Drupal\Core\Cache\RefinableCacheableDependencyInterface
45
   *   The cache metadata.
46
   */
47
  protected function getCacheMetadata(AbstractSchema $schema, callable $callback) {
48
    if (!$schema instanceof Schema) {
49
      return NULL;
50
    }
51
52
    $schemaPlugin = $schema->getSchemaPlugin();
53
    if (!$schemaPlugin instanceof PluggableSchemaPluginInterface) {
54
      return NULL;
55
    }
56
57
    /** @var \Drupal\graphql\Plugin\GraphQL\TypeSystemPluginInterface $plugin */
58
    if ($plugin = $this->getPlugin($schemaPlugin->getSchemaBuilder())) {
59
      return $callback($plugin);
60
    }
61
62
    return NULL;
63
  }
64
65
}