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

Breadcrumb

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

function ReverseContainer::__construct

Same name in this branch
  1. 11.1.x vendor/symfony/dependency-injection/ReverseContainer.php \Symfony\Component\DependencyInjection\ReverseContainer::__construct()

Constructs a ReverseContainer object.

Parameters

\Drupal\Component\DependencyInjection\Container|\Symfony\Component\DependencyInjection\Container $serviceContainer: The service container.

File

core/lib/Drupal/Component/DependencyInjection/ReverseContainer.php, line 35

Class

ReverseContainer
Retrieves service IDs from the container for public services.

Namespace

Drupal\Component\DependencyInjection

Code

public function __construct(Container|SymfonyContainer $serviceContainer) {
    $this->getServiceId = \Closure::bind(function ($service) : ?string {
        return array_search($service, $this->services, TRUE) ?: NULL;
    }, $serviceContainer, $serviceContainer);
}
RSS feed
Powered by Drupal