You are here

public static function Container::underscore in Service Container 7

Same name in this branch
  1. 7 src/DependencyInjection/Container.php \Drupal\service_container\DependencyInjection\Container::underscore()
  2. 7 modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/Container.php \Symfony\Component\DependencyInjection\Container::underscore()
Same name and namespace in other branches
  1. 7.2 modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/Container.php \Symfony\Component\DependencyInjection\Container::underscore()

A string to underscore.

Parameters

string $id The string to underscore:

Return value

string The underscored string

3 calls to Container::underscore()
Container::getServiceIds in modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/Container.php
Gets all service ids.
ContainerTest::testUnderscore in modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/Tests/ContainerTest.php
@dataProvider dataForTestUnderscore
Extension::getAlias in modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/Extension/Extension.php
Returns the recommended alias to use in XML.

File

modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/Container.php, line 570

Class

Container
Container is a dependency injection container.

Namespace

Symfony\Component\DependencyInjection

Code

public static function underscore($id) {
  return strtolower(preg_replace(array(
    '/([A-Z]+)([A-Z][a-z])/',
    '/([a-z\\d])([A-Z])/',
  ), array(
    '\\1_\\2',
    '\\1_\\2',
  ), strtr($id, '_', '.')));
}