Resolves a registered namespace alias to the full namespace.

@param string $entityNamespaceAlias

@return string

@throws ORMException
514953
public function getEntityNamespace($entityNamespaceAlias)
    {
        if ( ! isset($this->_attributes['entityNamespaces'][$entityNamespaceAlias])) {
            throw ORMException::unknownEntityNamespace($entityNamespaceAlias);
        }

        return trim($this->_attributes['entityNamespaces'][$entityNamespaceAlias], '\\');
    }
441665
protected function getEntityAlias()
    {
        $entityName = $this->getRepository()->getClassName();
        if (false !== strpos($entityName, '\\')) {
            $entityName = substr(
                $entityName,
                strrpos($entityName, '\\') + 1
            );
        }

        $matches = array();
        preg_match_all(
            '/[A-Z]/',
            $entityName,
            $matches
        );
        return strtolower(implode('', $matches[0]));
    }
517303
function aliasGetName($nameOrAlias) {
    if ('\\' === $nameOrAlias[0]) {
      return substr($nameOrAlias, 1);
    }
    elseif (array_key_exists($nameOrAlias, $this->namesByAlias)) {
      return $this->namesByAlias[$nameOrAlias];
    }
    elseif (NULL !== $this->namespaceName) {
      return $this->namespaceName . '\\' . $nameOrAlias;
    }
    else {
      return $nameOrAlias;
    }
  }
474546
public function getNamespace($namespace)
    {
        $classes = [];
        $definitions = $this->classes->extract();

        foreach (array_keys($definitions) as $class) {
            if (strpos($class, $namespace, 0) === 0) {
                $classes[$class] = $this->get($class);
            }
        }

        return $classes;
    }
1281293
protected function parseNamespaceDeclaration($namespaceDeclaration)
    {
        $result = preg_match(self::SPLIT_PATTERN_NAMESPACEDECLARATION, $namespaceDeclaration, $matches);
        if ($result !== 1 || !(isset($matches['alias']) && isset($matches['packageKey']))) {
            throw new Fusion\Exception('Invalid namespace declaration "' . $namespaceDeclaration . '"', 1180547190);
        }

        $namespaceAlias = $matches['alias'];
        $namespacePackageKey = $matches['packageKey'];
        $this->objectTypeNamespaces[$namespaceAlias] = $namespacePackageKey;
    }
5437
public function getEntityClassAlias()
    {
        if ($this->entityClassAlias === null) {
            $entityClass = $this->getEntityClass();
            $this->setEntityClassAlias(strtolower(substr($entityClass, strrpos($entityClass, '\\')+1, 1)));
        }
        return $this->entityClassAlias;
    }
389243
public function getNamespaceByCanonicalName( $canonicalName ) {
		$result = $this->getNamespaceResult()['query'];
		foreach ( $result['namespaces'] as $nsInfo ) {
			if ( !empty( $nsInfo['canonical'] ) && $nsInfo['canonical'] === $canonicalName ) {
				return $this->createNamespaceFromQuery( $nsInfo, $result['namespacealiases'] );
			}
		}
		return null;
	}
436812
protected function normalizeEntity($fullName, $_namespace = null)
    {
        // split fullname into entity parts
        $entityParts = explode('.', $fullName);
        if (count($entityParts) > 1) {
            // templates don't have a custom namespace
            $entity = array_pop($entityParts);
            // namespace might contain dots, so we explode
            $namespace = implode('.', $entityParts);
        } else {
            $entity = array_pop($entityParts);
            $namespace = $_namespace;
        }

        // If a dollar sign is used in the entity name,
        // we can't resolve without running the method,
        // and skip the processing. This is mostly used for
        // dynamically translating static properties, e.g. looping
        // through $db, which are detected by {@link collectFromEntityProviders}.
        if ($entity && strpos('$', $entity) !== false) {
            return false;
        }

        return "{$namespace}.{$entity}";
    }
1049005
public function toNamespacedString($namespace, array $aliased_classes, $this_class, $use_phpdoc_format)
    {
        if ($use_phpdoc_format) {
            if ($this instanceof TNamedObject) {
                return parent::toNamespacedString($namespace, $aliased_classes, $this_class, true);
            }

            return $this->value;
        }

        $param_string = '';
        $return_type_string = '';

        if ($this->params !== null) {
            $param_string = '(' . implode(
                ', ',
                array_map(
                    /**
                     * @return string
                     */
                    function (FunctionLikeParameter $param) use ($namespace, $aliased_classes, $this_class) {
                        if (!$param->type) {
                            $type_string = 'mixed';
                        } else {
                            $type_string = $param->type->toNamespacedString(
                                $namespace,
                                $aliased_classes,
                                $this_class,
                                false
                            );
                        }

                        return ($param->is_variadic ? '...' : '') . $type_string . ($param->is_optional ? '=' : '');
                    },
                    $this->params
                )
            ) . ')';
        }

        if ($this->return_type !== null) {
            $return_type_multiple = count($this->return_type->getTypes()) > 1;

            $return_type_string = ':' . ($return_type_multiple ? '(' : '') . $this->return_type->toNamespacedString(
                $namespace,
                $aliased_classes,
                $this_class,
                false
            ) . ($return_type_multiple ? ')' : '');
        }

        if ($this instanceof TNamedObject) {
            return parent::toNamespacedString($namespace, $aliased_classes, $this_class, true)
                . $param_string . $return_type_string;
        }

        return 'callable' . $param_string . $return_type_string;
    }
569703
function getPrefixFromNamespace($ns)
    {
        foreach ($this->namespaces as $p => $n) {
            if ($ns == $n || $ns == $p) {
                $this->usedNamespaces[$p] = $n;

                return $p;
            }
        }

        return FALSE;
    }
1154700
public function findNamespace(string $namespace): string
	{
		$allNamespaces = $this->getNamespaces();

		$expr = preg_replace_callback(
			'{([^:]+|)}',
			function ($matches)
			{
				return preg_quote($matches[1]) . '[^:]*';
			},
			$namespace
		);

		$namespaces = preg_grep('{^' . $expr . '}', $allNamespaces);

		if (empty($namespaces))
		{
			throw new NamespaceNotFoundException(sprintf('There are no commands defined in the "%s" namespace.', $namespace));
		}

		$exact = \in_array($namespace, $namespaces, true);

		if (\count($namespaces) > 1 && !$exact)
		{
			throw new NamespaceNotFoundException(sprintf('The namespace "%s" is ambiguous.', $namespace));
		}

		return $exact ? $namespace : reset($namespaces);
	}
1117888
private function resolvePhpDocParamTypes($tokens, $useDeclarations, $namespaceDeclarations)
    {
        foreach ($tokens->findGivenKind(T_DOC_COMMENT) as $token) {
            $doc = new DocBlock($token->getContent());
            $annotations = $doc->getAnnotationsOfType('param');
            if (empty($annotations)) {
                continue;
            }
            foreach ($annotations as $annotation) {
                $line = $doc->getLine($annotation->getStart());

                $matches = $this->getMatches($line->getContent());
                if (null === $matches) {
                    continue;
                }

                if (!isset($matches['hint'])) {
                    continue;
                }

                if (substr($matches['hint'], 0, 1) === '\\') {
                    continue;
                }

                if (false !== strpos($matches['hint'], '\\')) {
                    continue;
                }

                $resolved = false;

                // resolve hint
                foreach ($useDeclarations as $useDeclaration) {
                    // replace hint by useDeclaration fullname if it match
                    if (in_array($matches['hint'], array($useDeclaration['shortName'], $useDeclaration['aliased']), true)) {
                        $line->setContent(str_replace($matches['hint'], $useDeclaration['fullName'], $line->getContent()));
                        $resolved = true;
                        break;
                    }
                }

                if ($resolved) {
                    continue;
                }

                // add namespace if needed
                $namespace = $namespaceDeclarations[0]['name'];

                if (false === strpos($matches['hint'], '\\')) {
                    $line->setContent(str_replace($matches['hint'], $namespace.'\\'.$matches['hint'], $line->getContent()));
                }
            }

            $token->setContent($doc->getContent());
        }
    }
967646
protected function getNamespace($namespace = null)
    {
        if (!is_null($namespace)) {
            $parts = explode('\\', $namespace);

            array_pop($parts);

            return join('\\', $parts);
        }

        return $this->getAppNamespace() . $this->namespace;
    }
772710
public function registryAlias($registryAlias = null)
    {
        deprecationWarning(
            get_called_class() . '::registryAlias() is deprecated. ' .
            'Use setRegistryAlias()/getRegistryAlias() instead.'
        );
        if ($registryAlias !== null) {
            $this->setRegistryAlias($registryAlias);
        }

        return $this->getRegistryAlias();
    }
601663
public function removeNamespaceAlias()
	{
		$from = func_get_args();

		$filter = function($namespace) use ($from)
		{
			return ! in_array($namespace[0], $from);
		};

		$this->namespaces = array_filter($this->namespaces, $filter);
	}
986437
public function createNamespace($namespaceName)
    {
        $unquotedNamespaceName = strtolower($this->getUnquotedAssetName($namespaceName));

        if (isset($this->namespaces[$unquotedNamespaceName])) {
            throw SchemaException::namespaceAlreadyExists($unquotedNamespaceName);
        }

        $this->namespaces[$unquotedNamespaceName] = $namespaceName;

        return $this;
    }
618514
protected function getBaseNamespace($options = null){
		if(empty($options)){
			$options = $this->getOptions();
		}
		if(empty($options->getBaseNamespace())){
			$parts = explode("\\", get_class($this));
			if(count($parts) <= 1){
				throw new \Exception('Empty entity namespace');
			}
			return $parts[0];
		}
		return $options->getBaseNamespace();
	}