function ProxyBuilder::buildProxyClassName

Same name in other branches
  1. 9 core/lib/Drupal/Component/ProxyBuilder/ProxyBuilder.php \Drupal\Component\ProxyBuilder\ProxyBuilder::buildProxyClassName()
  2. 8.9.x core/lib/Drupal/Component/ProxyBuilder/ProxyBuilder.php \Drupal\Component\ProxyBuilder\ProxyBuilder::buildProxyClassName()
  3. 10 core/lib/Drupal/Component/ProxyBuilder/ProxyBuilder.php \Drupal\Component\ProxyBuilder\ProxyBuilder::buildProxyClassName()

Generates the used proxy class name from a given class name.

Parameters

string $class_name: The class name of the actual service.

Return value

string The class name of the proxy.

3 calls to ProxyBuilder::buildProxyClassName()
ProxyBuilder::build in core/lib/Drupal/Component/ProxyBuilder/ProxyBuilder.php
Builds a proxy class string.
ProxyBuilder::buildProxyNamespace in core/lib/Drupal/Component/ProxyBuilder/ProxyBuilder.php
Generates the used proxy namespace from a given class name.
ProxyServicesPass::process in core/lib/Drupal/Core/DependencyInjection/Compiler/ProxyServicesPass.php

File

core/lib/Drupal/Component/ProxyBuilder/ProxyBuilder.php, line 19

Class

ProxyBuilder
Generates the string representation of the proxy service.

Namespace

Drupal\Component\ProxyBuilder

Code

public static function buildProxyClassName($class_name) {
    $match = [];
    preg_match('/([a-zA-Z0-9_]+\\\\[a-zA-Z0-9_]+)\\\\(.+)/', $class_name, $match);
    $root_namespace = $match[1];
    $rest_fqcn = $match[2];
    $proxy_class_name = $root_namespace . '\\ProxyClass\\' . $rest_fqcn;
    return $proxy_class_name;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.