Completed
Pull Request — 8.x-3.x (#525)
by Philipp
05:17
created

SchemaPluginManager   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 41
rs 10
c 0
b 0
f 0
wmc 1
lcom 0
cbo 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 20 1
1
<?php
2
3
namespace Drupal\graphql\Plugin;
4
5
use Drupal\Core\Cache\CacheBackendInterface;
6
use Drupal\Core\Extension\ModuleHandlerInterface;
7
use Drupal\Core\Plugin\DefaultPluginManager;
8
9
class SchemaPluginManager extends DefaultPluginManager {
10
11
  /**
12
   * SchemaPluginManager constructor.
13
   *
14
   * @param bool|string $pluginSubdirectory
15
   *   The plugin's subdirectory.
16
   * @param \Traversable $namespaces
17
   *   An object that implements \Traversable which contains the root paths
18
   *   keyed by the corresponding namespace to look for plugin implementations.
19
   * @param \Drupal\Core\Extension\ModuleHandlerInterface $moduleHandler
20
   *   The module handler.
21
   * @param \Drupal\Core\Cache\CacheBackendInterface $cacheBackend
22
   *   The cache backend.
23
   * @param string|null $pluginInterface
24
   *   The interface each plugin should implement.
25
   * @param string $pluginAnnotationName
26
   *   The name of the annotation that contains the plugin definition.
27
   */
28
  public function __construct(
29
    $pluginSubdirectory,
30
    \Traversable $namespaces,
31
    ModuleHandlerInterface $moduleHandler,
32
    CacheBackendInterface $cacheBackend,
33
    $pluginInterface,
34
    $pluginAnnotationName
35
  ) {
36
    parent::__construct(
37
      $pluginSubdirectory,
38
      $namespaces,
39
      $moduleHandler,
40
      $pluginInterface,
41
      $pluginAnnotationName
42
    );
43
44
    $this->alterInfo('graphql_schema');
45
    $this->useCaches(TRUE);
46
    $this->setCacheBackend($cacheBackend, 'schemas', ['graphql', 'graphql:schemas']);
47
  }
48
49
}
50