W3cubDocs

/Drupal 8

public function ContainerBuilder::register

public ContainerBuilder::register($id, $class = null)

Registers a service definition.

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

Parameters

string $id The service identifier:

string $class The service class:

Return value

Definition A Definition instance

Overrides ContainerBuilder::register

File

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

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);
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!DependencyInjection!ContainerBuilder.php/function/ContainerBuilder::register/8.1.x