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

Breadcrumb

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

function ServiceLocatorTrait::getProvidedServices

2 calls to ServiceLocatorTrait::getProvidedServices()
ServiceLocator::count in vendor/symfony/dependency-injection/ServiceLocator.php
ServiceLocator::getIterator in vendor/symfony/dependency-injection/ServiceLocator.php
1 method overrides ServiceLocatorTrait::getProvidedServices()
ServiceLocator::getProvidedServices in vendor/symfony/dependency-injection/Argument/ServiceLocator.php

File

vendor/symfony/service-contracts/ServiceLocatorTrait.php, line 68

Class

ServiceLocatorTrait
A trait to help implement ServiceProviderInterface.

Namespace

Symfony\Contracts\Service

Code

public function getProvidedServices() : array {
    if (!isset($this->providedTypes)) {
        $this->providedTypes = [];
        foreach ($this->factories as $name => $factory) {
            if (!\is_callable($factory)) {
                $this->providedTypes[$name] = '?';
            }
            else {
                $type = (new \ReflectionFunction($factory))->getReturnType();
                $this->providedTypes[$name] = $type ? ($type->allowsNull() ? '?' : '') . ($type instanceof \ReflectionNamedType ? $type->getName() : $type) : '?';
            }
        }
    }
    return $this->providedTypes;
}
RSS feed
Powered by Drupal