You are here

public function XhprofServiceProvider::register in XHProf 8

Registers services to the container.

Parameters

ContainerBuilder $container: The ContainerBuilder to register services to.

Overrides ServiceProviderBase::register

File

src/XhprofServiceProvider.php, line 19

Class

XhprofServiceProvider
Defines a service profiler for the xhprof module.

Namespace

Drupal\xhprof

Code

public function register(ContainerBuilder $container) {
  $container
    ->addCompilerPass(new StoragePass());
  if (FALSE !== $container
    ->hasDefinition('profiler')) {
    $container
      ->register('webprofiler.xhprof', XHProfDataCollector::class)
      ->addArgument(new Reference('xhprof.profiler'))
      ->addTag('data_collector', [
      'template' => '@xhprof/Collector/xhprof.html.twig',
      'id' => 'xhprof',
      'title' => 'XHProf',
      'priority' => 50,
    ]);
  }
}