function PhpDumper::generateMethodName
Throws
6 calls to PhpDumper::generateMethodName()
- PhpDumper::addDeprecatedAliases in vendor/
symfony/ dependency-injection/ Dumper/ PhpDumper.php - PhpDumper::addFileMap in vendor/
symfony/ dependency-injection/ Dumper/ PhpDumper.php - PhpDumper::addMethodMap in vendor/
symfony/ dependency-injection/ Dumper/ PhpDumper.php - PhpDumper::addService in vendor/
symfony/ dependency-injection/ Dumper/ PhpDumper.php - PhpDumper::dumpValue in vendor/
symfony/ dependency-injection/ Dumper/ PhpDumper.php
File
-
vendor/
symfony/ dependency-injection/ Dumper/ PhpDumper.php, line 2102
Class
- PhpDumper
- PhpDumper dumps a service container as a PHP class.
Namespace
Symfony\Component\DependencyInjection\DumperCode
private function generateMethodName(string $id) : string {
if (isset($this->serviceIdToMethodNameMap[$id])) {
return $this->serviceIdToMethodNameMap[$id];
}
$i = strrpos($id, '\\');
$name = Container::camelize(false !== $i && isset($id[1 + $i]) ? substr($id, 1 + $i) : $id);
$name = preg_replace('/[^a-zA-Z0-9_\\x7f-\\xff]/', '', $name);
$methodName = 'get' . $name . 'Service';
$suffix = 1;
while (isset($this->usedMethodNames[strtolower($methodName)])) {
++$suffix;
$methodName = 'get' . $name . $suffix . 'Service';
}
$this->serviceIdToMethodNameMap[$id] = $methodName;
$this->usedMethodNames[strtolower($methodName)] = true;
return $methodName;
}