You are here

public function ContainerBuilder::register in Service Container 7

Same name in this branch
  1. 7 lib/Drupal/Core/DependencyInjection/ContainerBuilder.php \Drupal\Core\DependencyInjection\ContainerBuilder::register()
  2. 7 modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/ContainerBuilder.php \Symfony\Component\DependencyInjection\ContainerBuilder::register()
Same name and namespace in other branches
  1. 7.2 lib/Drupal/Core/DependencyInjection/ContainerBuilder.php \Drupal\Core\DependencyInjection\ContainerBuilder::register()

Registers a service definition.

This methods allows for simple registration of service definition with a fluid interface.

@api

Parameters

string $id The service identifier:

string $class The service class:

Return value

Definition A Definition instance

Overrides ContainerBuilder::register

File

lib/Drupal/Core/DependencyInjection/ContainerBuilder.php, line 58
Contains \Drupal\Core\DependencyInjection\ContainerBuilder.

Class

ContainerBuilder
Drupal's dependency injection container builder.

Namespace

Drupal\Core\DependencyInjection

Code

public function register($id, $class = null) {
  if (strtolower($id) !== $id) {
    throw new \InvalidArgumentException("Service ID names must be lowercase: {$id}");
  }
  return parent::register($id, $class);
}