You are here

CompilerPluginManager.php in Compiler 1.0.x

File

src/Plugin/CompilerPluginManager.php
View source
<?php

namespace Drupal\compiler\Plugin;

use Drupal\Core\Cache\CacheBackendInterface;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\Plugin\DefaultPluginManager;
use Drupal\compiler\Annotation\Compiler;

/**
 * Defines the compiler plugin manager provided by this module.
 *
 * Copyright (C) 2021  Library Solutions, LLC (et al.).
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 */
class CompilerPluginManager extends DefaultPluginManager implements CompilerPluginManagerInterface {

  /**
   * Constructs a CompilerPluginManager object.
   *
   * @param \Traversable $namespaces
   *   An object that implements \Traversable which contains the root paths
   *   keyed by the corresponding namespace to look for plugin implementations.
   * @param \Drupal\Core\Cache\CacheBackendInterface $cache_backend
   *   Cache backend instance to use.
   * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
   *   The module handler to invoke the alter hook with.
   */
  public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler) {
    parent::__construct('Plugin/Compiler', $namespaces, $module_handler, CompilerPluginInterface::class, Compiler::class);
    $this
      ->alterInfo('compiler_info');
    $this
      ->setCacheBackend($cache_backend, 'compiler_plugins');
  }

}

Classes

Namesort descending Description
CompilerPluginManager Defines the compiler plugin manager provided by this module.