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

Breadcrumb

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

function ServiceLocator::get

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

Overrides ServiceLocator::get

File

vendor/symfony/dependency-injection/Argument/ServiceLocator.php, line 31

Class

ServiceLocator
@author Nicolas Grekas <p@tchwork.com>

Namespace

Symfony\Component\DependencyInjection\Argument

Code

public function get(string $id) : mixed {
    return match (\count($this->serviceMap[$id] ?? [])) {    0 => parent::get($id),
        1 => $this->serviceMap[$id][0],
        default => ($this->factory)(...$this->serviceMap[$id]),
    
    };
}
RSS feed
Powered by Drupal