Completed
Pull Request — 8.x-3.x (#525)
by Sebastian
02:06
created

TypePluginManager   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 21 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 TypePluginManager extends DefaultPluginManager {
10
11
  /**
12
   * TypePluginManager 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
   * @param string $pluginType
28
   *   The plugin type.
29
   */
30
  public function __construct(
31
    $pluginSubdirectory,
32
    \Traversable $namespaces,
33
    ModuleHandlerInterface $moduleHandler,
34
    CacheBackendInterface $cacheBackend,
35
    $pluginInterface,
36
    $pluginAnnotationName,
37
    $pluginType
38
  ) {
39
    parent::__construct(
40
      $pluginSubdirectory,
41
      $namespaces,
42
      $moduleHandler,
43
      $pluginInterface,
44
      $pluginAnnotationName
45
    );
46
47
    $this->alterInfo("graphql_{$pluginType}");
48
    $this->useCaches(TRUE);
49
    $this->setCacheBackend($cacheBackend, $pluginType, ['graphql', "graphql:{$pluginType}"]);
50
  }
51
52
}
53