You are here

protected function DrupalKernel::initializeServiceProviders in Drupal 8

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/DrupalKernel.php \Drupal\Core\DrupalKernel::initializeServiceProviders()

Registers all service providers to the kernel.

Throws

\LogicException

1 call to DrupalKernel::initializeServiceProviders()
DrupalKernel::compileContainer in core/lib/Drupal/Core/DrupalKernel.php
Compiles a new service container.

File

core/lib/Drupal/Core/DrupalKernel.php, line 1344

Class

DrupalKernel
The DrupalKernel class is the core of Drupal itself.

Namespace

Drupal\Core

Code

protected function initializeServiceProviders() {
  $this
    ->discoverServiceProviders();
  $this->serviceProviders = [
    'app' => [],
    'site' => [],
  ];
  foreach ($this->serviceProviderClasses as $origin => $classes) {
    foreach ($classes as $name => $class) {
      if (!is_object($class)) {
        $this->serviceProviders[$origin][$name] = new $class();
      }
      else {
        $this->serviceProviders[$origin][$name] = $class;
      }
    }
  }
}