Code Duplication    Length = 11-12 lines in 2 locations

src/GraphQL/Schema/SchemaLoader.php 2 locations

@@ 245-255 (lines=11) @@
242
   * @return \Drupal\Core\Cache\CacheableMetadata
243
   *   The cache metadata collected from the schema's types.
244
   */
245
  protected function extractSchemaCacheMetadata(AbstractSchema $schema) {
246
    $metadata = new CacheableMetadata();
247
    $metadata->setCacheMaxAge(Cache::PERMANENT);
248
    $metadata->addCacheTags(['graphql_schema']);
249
250
    $metadata->addCacheableDependency($this->collectCacheMetadata($schema, function (CacheableEdgeInterface $item, AbstractSchema $schema) {
251
      return $item->getSchemaCacheMetadata($schema);
252
    }));
253
254
    return $metadata;
255
  }
256
257
  /**
258
   * Collects result cache metadata from all types registered with the schema.
@@ 269-280 (lines=12) @@
266
   * @return \Drupal\Core\Cache\CacheableMetadata
267
   *   The cache metadata collected from the schema's types.
268
   */
269
  protected function extractResponseCacheMetadata(AbstractSchema $schema) {
270
    $metadata = new CacheableMetadata();
271
    $metadata->setCacheMaxAge(Cache::PERMANENT);
272
    $metadata->addCacheTags(['graphql_response']);
273
    $metadata->addCacheContexts(['gql']);
274
275
    $metadata->addCacheableDependency($this->collectCacheMetadata($schema, function (CacheableEdgeInterface $item, AbstractSchema $schema) {
276
      return $item->getResponseCacheMetadata($schema);
277
    }));
278
279
    return $metadata;
280
  }
281
282
  /**
283
   * Recursively collects cache metadata from the generated schema.