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

Breadcrumb

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

function PhpDumper::generateMethodName

Throws

InvalidArgumentException

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

... See full list

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\Dumper

Code

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;
}
RSS feed
Powered by Drupal