function StaticReflectionParser::fullySpecifyName
Same name in other branches
- 11.x core/lib/Drupal/Component/Annotation/Doctrine/StaticReflectionParser.php \Drupal\Component\Annotation\Doctrine\StaticReflectionParser::fullySpecifyName()
Converts a name into a fully specified name.
Parameters
string $name The name to convert.:
Return value
string
1 call to StaticReflectionParser::fullySpecifyName()
- StaticReflectionParser::parse in core/
lib/ Drupal/ Component/ Annotation/ Doctrine/ StaticReflectionParser.php
File
-
core/
lib/ Drupal/ Component/ Annotation/ Doctrine/ StaticReflectionParser.php, line 365
Class
- StaticReflectionParser
- Parses a file for namespaces/use/class declarations.
Namespace
Drupal\Component\Annotation\DoctrineCode
private function fullySpecifyName(string $name) : string {
$nsPos = strpos($name, '\\');
$fullySpecified = false;
if ($nsPos === 0) {
$fullySpecified = true;
}
else {
if ($nsPos) {
$prefix = strtolower(substr($name, 0, $nsPos));
$postfix = substr($name, $nsPos);
}
else {
$prefix = strtolower($name);
$postfix = '';
}
foreach ($this->useStatements as $alias => $use) {
if ($alias !== $prefix) {
continue;
}
$name = '\\' . $use . $postfix;
$fullySpecified = true;
}
}
if (!$fullySpecified) {
$name = '\\' . $this->namespace . '\\' . $name;
}
return $name;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.