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\DependencyInjectionCode
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) : '');
}