function DrupalKernel::__construct

Same name in other branches
  1. 8.9.x core/lib/Drupal/Core/DrupalKernel.php \Drupal\Core\DrupalKernel::__construct()
  2. 10 core/lib/Drupal/Core/DrupalKernel.php \Drupal\Core\DrupalKernel::__construct()
  3. 11.x core/lib/Drupal/Core/DrupalKernel.php \Drupal\Core\DrupalKernel::__construct()

Constructs a DrupalKernel object.

Parameters

string $environment: String indicating the environment, e.g. 'prod' or 'dev'.

$class_loader: The class loader. Normally \Composer\Autoload\ClassLoader, as included by the front controller, but may also be decorated.

bool $allow_dumping: (optional) FALSE to stop the container from being written to or read from disk. Defaults to TRUE.

string $app_root: (optional) The path to the application root as a string. If not supplied, the application root will be computed.

2 calls to DrupalKernel::__construct()
TestKernel::__construct in core/lib/Drupal/Core/Test/TestKernel.php
Constructs a DrupalKernel object.
TestRunnerKernel::__construct in core/lib/Drupal/Core/Test/TestRunnerKernel.php
Constructs a DrupalKernel object.
2 methods override DrupalKernel::__construct()
TestKernel::__construct in core/lib/Drupal/Core/Test/TestKernel.php
Constructs a DrupalKernel object.
TestRunnerKernel::__construct in core/lib/Drupal/Core/Test/TestRunnerKernel.php
Constructs a DrupalKernel object.

File

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

Class

DrupalKernel
The DrupalKernel class is the core of Drupal itself.

Namespace

Drupal\Core

Code

public function __construct($environment, $class_loader, $allow_dumping = TRUE, $app_root = NULL) {
    $this->environment = $environment;
    $this->classLoader = $class_loader;
    $this->allowDumping = $allow_dumping;
    if ($app_root === NULL) {
        $app_root = static::guessApplicationRoot();
    }
    $this->root = $app_root;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.