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

Breadcrumb

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

function ServiceLocator::formatAlternatives

1 call to ServiceLocator::formatAlternatives()
ServiceLocator::createNotFoundException in vendor/symfony/dependency-injection/ServiceLocator.php

File

vendor/symfony/dependency-injection/ServiceLocator.php, line 145

Class

ServiceLocator
@author Robin Chalas <robin.chalas@gmail.com> @author Nicolas Grekas <p@tchwork.com>

Namespace

Symfony\Component\DependencyInjection

Code

private function formatAlternatives(?array $alternatives = null, string $separator = 'and') : string {
    $format = '"%s"%s';
    if (null === $alternatives) {
        if (!($alternatives = array_keys($this->factories))) {
            return 'is empty...';
        }
        $format = \sprintf('only knows about the %s service%s.', $format, 1 < \count($alternatives) ? 's' : '');
    }
    $last = array_pop($alternatives);
    return \sprintf($format, $alternatives ? implode('", "', $alternatives) : $last, $alternatives ? \sprintf(' %s "%s"', $separator, $last) : '');
}
RSS feed
Powered by Drupal