Converts PHP namespace to service name.
502703
private function createServiceName(string $namespace)
	{
		$parts = explode('\\', $namespace);
		foreach ($parts as $k => $part) {
			$parts[$k] = lcfirst($part);
		}
		return trim(implode('.', $parts), '.');
	}
1319103
def namespace_to_regex(namespace):
    """"""
    db_name, coll_name = namespace.split(".", 1)
    # A database name cannot contain a '.' character
    db_regex = re.escape(db_name).replace(r"\*", "([^.]*)")
    # But a collection name can.
    coll_regex = re.escape(coll_name).replace(r"\*", "(.*)")
    return re.compile(r"\A" + db_regex + r"\." + coll_regex + r"\Z")
1082942
protected function getDefaultNamespace($rootNamespace)
    {
        $namespace = Config::get('service-classes.cached_services.namespace');
        $serviceNamespace = Config::get('service-classes.namespace');

        if (! $serviceNamespace) {
            throw InvalidNamespaceException::missingServiceNamespace();
        }

        return $this->defaultNamespace = $namespace ? $rootNamespace.'\\'.Config::get('service-classes.namespace').'\\'.$namespace
                      : $rootNamespace.'\\'.Config::get('service-classes.cached_services.namespace');
    }
351551
static function switchToRequestedNamespace($default_namespace)
    {
        $session_name = $default_namespace;

        // Check for Posted Session Name and use that if specified
        if (isset($_REQUEST['reportico_session_name'])) {
            $session_name = $_REQUEST['reportico_session_name'];
            if (preg_match("/_/", $session_name)) {

                $ar = explode("_", $session_name);
                ReporticoApp::set("session_namespace", $ar[1]);
                if (ReporticoApp::get("session_namespace")) {
                    ReporticoApp::set("session_namespace_key", "reportico_" . ReporticoApp::get("session_namespace"));
                }

                // Set session to join only if it is not NS meaning its called from framework and existing session
                // should be used
                //if ($ar[0] != "NS") {
                    $session_name = $ar[1];
                //}

            }
        }
        return $session_name;
    }
947882
protected function getNamespace($name)
    {
        $name = explode('\\', $name);
        
        unset($name[(count($name) - 1)]);

        $nameSpace = implode('\\', $name);

        return trim($nameSpace);
    }
780617
public function toNamespacedString($namespace, array $aliased_classes, $this_class, $use_phpdoc_format)
    {
        if ($this->as === 'object') {
            return 'class-string';
        }

        if ($namespace && stripos($this->as, $namespace . '\\') === 0) {
            return 'class-string<' . preg_replace(
                '/^' . preg_quote($namespace . '\\') . '/i',
                '',
                $this->as
            ) . '>';
        }

        if (!$namespace && stripos($this->as, '\\') === false) {
            return 'class-string<' . $this->as . '>';
        }

        if (isset($aliased_classes[strtolower($this->as)])) {
            return 'class-string<' . $aliased_classes[strtolower($this->as)] . '>';
        }

        return 'class-string<\\' . $this->as . '>';
    }
917747
private static function classBelongsToNamespace($className, $namespaces)
    {
        $belongsToNamespace = false;
        $check = array_values($namespaces);
        $lcClassName = strtolower(ltrim($className, '\\'));

        foreach ($check as $namespace) {
            if (false !== strpos($lcClassName, strtolower($namespace))) {
                $belongsToNamespace = true;
                continue;
            }
        }
        return $belongsToNamespace;
    }
105443
public function basename(string $namespace): string
    {
        $strrpos = \strrpos($namespace, '\\');
        if (false === $strrpos) {
            return $namespace;
        }

        return $this->tidy(\substr($namespace, $strrpos + 1));
    }
174467
public function getNamespacedName() : ResolvedName {
        $namespaceDefinition = $this->getNamespaceDefinition();
        $content = $this->getFileContents();
        if ($namespaceDefinition === null) {
            // global namespace -> strip namespace\ prefix
            return ResolvedName::buildName($this->getNameParts(), $content);
        }

        if ($namespaceDefinition->name !== null) {
            $resolvedName = ResolvedName::buildName($namespaceDefinition->name->nameParts, $content);
        } else {
            $resolvedName = ResolvedName::buildName([], $content);
        }
        if (
            !($this instanceof QualifiedName && (
            ($this->parent instanceof NamespaceDefinition) ||
            ($this->parent instanceof NamespaceUseDeclaration) ||
            ($this->parent instanceof NamespaceUseClause) ||
            ($this->parent instanceof NamespaceUseGroupClause)))
        ) {
            $resolvedName->addNameParts($this->getNameParts(), $content);
        }
        return $resolvedName;
    }
672150
def hbp_namespace(name: str, sha: Optional[str] = None) -> str:
    """"""
    return HBP_NAMESPACE_URL.format(sha=sha or LAST_HASH, keyword=name)
1163210
function aliasGetName($nameOrAlias) {
    if ('\\' === $nameOrAlias[0]) {
      return substr($nameOrAlias, 1);
    }
    elseif (NULL !== $this->namespaceName) {
      return $this->namespaceName . '\\' . $nameOrAlias;
    }
    else {
      return $nameOrAlias;
    }
  }
843318
def prefixed_to_namespaced(C, prefixed_name, namespaces):
        
        if ':' not in prefixed_name:
            return prefixed_name
        else:
            prefix, name = prefixed_name.split(':')
            namespace = namespaces[prefix]
            return "{%s}%s" % (namespace, name)
1276525
public function getNamespace(): string
	{
		$namespace = ($this->namespace !== null ? $this->namespace . '.' : '') . $this->name;

		$parent = $this->parent;
		if ($parent instanceof Item) {
			$namespace = $this->parent->getNamespace() . '.' . $namespace;
		}
		return $namespace;
	}
676494
private static function translateBaseService()
    {
        $cachedServicePrefix = Config::get('service-classes.cached_services.prefix');
        $cachedServiceNamespace = '\\'.Config::get('service-classes.cached_services.namespace');

        return str_replace([$cachedServicePrefix, $cachedServiceNamespace], ['', ''], static::class);
    }
1310653
public function convertNamespaceToPath($namespace)
    {
        // remove the app namespace from the namespace if it is there
        $appNamespace = $this->getAppNamespace();

        if (substr($namespace, 0, strlen($appNamespace)) == $appNamespace) {
            $namespace = substr($namespace, strlen($appNamespace));
        }

        // trim and return the path
        return str_replace('\\', '/', trim($namespace, ' \\'));
    }
1286774
private function namespaces(): \Generator
    {
        foreach ($this->map() as $namespace => $directories) {
            if ($this->isValidNamespace($namespace, $directories)) {
                yield new Psr4Namespace($namespace, ...$directories);
            }
        }
    }
1297419
def get(self, namespacePrefix):
        """"""
        ns = db.ConfigNamespace.find_one(ConfigNamespace.namespace_prefix == namespacePrefix)
        if not ns:
            return self.make_response('No such namespace: {}'.format(namespacePrefix), HTTP.NOT_FOUND)

        return self.make_response({
            'message': None,
            'namespace': ns
        })