Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. PhpArrayContainer.php

function PhpArrayContainer::__construct

Overrides Container::__construct

File

core/lib/Drupal/Component/DependencyInjection/PhpArrayContainer.php, line 31

Class

PhpArrayContainer
Provides a container optimized for Drupal's needs.

Namespace

Drupal\Component\DependencyInjection

Code

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 = $container_definition['aliases'] ?? [];
    $this->parameters = $container_definition['parameters'] ?? [];
    $this->serviceDefinitions = $container_definition['services'] ?? [];
    $this->frozen = $container_definition['frozen'] ?? FALSE;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal