You are here

public function ContainerRebuildTestServiceProvider::alter in Drupal 9

Modifies existing service definitions.

Parameters

ContainerBuilder $container: The ContainerBuilder whose service definitions can be altered.

Overrides ServiceModifierInterface::alter

File

core/modules/system/tests/modules/container_rebuild_test/src/ContainerRebuildTestServiceProvider.php, line 13

Class

ContainerRebuildTestServiceProvider

Namespace

Drupal\container_rebuild_test

Code

public function alter(ContainerBuilder $container) {
  $count = $container
    ->get('state')
    ->get('container_rebuild_test.count', 0);
  $container
    ->get('state')
    ->set('container_rebuild_test.count', ++$count);
}