You are here

public function ProviderManager::getProvider in Persistent URL 8

File

src/Plugin/ProviderManager.php, line 107

Class

ProviderManager

Namespace

Drupal\purl\Plugin

Code

public function getProvider($id) {
  if (!isset($this->providers[$id])) {
    $plugin = $this
      ->createInstance($id);
    $definition = $this
      ->getDefinition($id);
    $plugin
      ->setId($id);
    if ($plugin instanceof ContainerAwareInterface) {
      $plugin
        ->setContainer($this->container);
    }
    if ($plugin instanceof ConfigurableInterface) {
      $plugin
        ->setSettings($definition['settings']);
    }
    $this->providers[$id] = $plugin;
  }
  return $this->providers[$id];
}