function PhpArrayContainer::__construct
Same name in other branches
- 9 core/lib/Drupal/Component/DependencyInjection/PhpArrayContainer.php \Drupal\Component\DependencyInjection\PhpArrayContainer::__construct()
- 10 core/lib/Drupal/Component/DependencyInjection/PhpArrayContainer.php \Drupal\Component\DependencyInjection\PhpArrayContainer::__construct()
- 11.x core/lib/Drupal/Component/DependencyInjection/PhpArrayContainer.php \Drupal\Component\DependencyInjection\PhpArrayContainer::__construct()
Overrides Container::__construct
File
-
core/
lib/ Drupal/ Component/ DependencyInjection/ PhpArrayContainer.php, line 30
Class
- PhpArrayContainer
- Provides a container optimized for Drupal's needs.
Namespace
Drupal\Component\DependencyInjectionCode
public function __construct(array $container_definition = []) {
if (isset($container_definition['machine_format']) && $container_definition['machine_format'] === TRUE) {
throw new InvalidArgumentException('The machine-optimized format is not supported by this class. Use a human-readable format instead, e.g. as produced by \\Drupal\\Component\\DependencyInjection\\Dumper\\PhpArrayDumper.');
}
// Do not call the parent's constructor as it would bail on the
// machine-optimized format.
$this->aliases = isset($container_definition['aliases']) ? $container_definition['aliases'] : [];
$this->parameters = isset($container_definition['parameters']) ? $container_definition['parameters'] : [];
$this->serviceDefinitions = isset($container_definition['services']) ? $container_definition['services'] : [];
$this->frozen = isset($container_definition['frozen']) ? $container_definition['frozen'] : FALSE;
// Register the service_container with itself.
$this->services['service_container'] = $this;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.