ContainerBuilder::shareService

protected ContainerBuilder::shareService(Definition $definition, $service, $id)

Direct copy of the parent function.

Overrides ContainerBuilder::shareService

File

core/lib/Drupal/Core/DependencyInjection/ContainerBuilder.php, line 51

Class

ContainerBuilder
Drupal's dependency injection container builder.

Namespace

Drupal\Core\DependencyInjection

Code

protected function shareService(Definition $definition, $service, $id) 
 {
  if ($definition->isShared() && self::SCOPE_PROTOTYPE !== $scope = $definition->getScope(false)) {
    if (self::SCOPE_CONTAINER !== $scope && !isset($this->scopedServices[$scope])) {
      throw new InactiveScopeException($id, $scope);
    }

    $this->services[$lowerId = strtolower($id)] = $service;

    if (self::SCOPE_CONTAINER !== $scope) {
      $this->scopedServices[$scope][$lowerId] = $service;
    }
  }
}
doc_Drupal
2016-10-29 08:56:42
Comments
Leave a Comment

Please login to continue.