Coverage index

src/VisitorsLocationPluginManager.php

Lines: 100.00%

LineHitsSource
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Drupal\visitors;
6
7
use Drupal\Core\Cache\CacheBackendInterface;
8
use Drupal\Core\Extension\ModuleHandlerInterface;
9
use Drupal\Core\Plugin\DefaultPluginManager;
10
11
/**
12
 * Plugin manager for visit location plugins.
13
 */
14
class VisitorsLocationPluginManager extends DefaultPluginManager {
15
16
  /**
17
   * Constructs a VisitorsLocationPluginManager.
18
   *
19
   * @param \Traversable $namespaces
20
   *   An object that implements \Traversable which contains the root paths
21
   *   keyed by the corresponding namespace to look for plugin implementations.
22
   * @param \Drupal\Core\Cache\CacheBackendInterface $cache_backend
23
   *   Cache backend instance to use.
24
   * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
25
   *   The module handler to invoke the alter hook with.
26
   */
27
  public function __construct(
28
    \Traversable $namespaces,
29
    CacheBackendInterface $cache_backend,
30
    ModuleHandlerInterface $module_handler,
31
  ) {
3211
    parent::__construct(
3311
      'Plugin/VisitorsLocation',
3411
      $namespaces,
3511
      $module_handler,
3611
      'Drupal\visitors\VisitorsLocationPluginInterface',
3711
      'Drupal\visitors\Attribute\VisitorsLocation',
3811
    );
39
4011
    $this->alterInfo('visitors_location_info');
4111
    $this->setCacheBackend($cache_backend, 'visitors_location_plugins');
42
  }
43
44
}