Normalizes enitities with namespaces.

@param string $fullName
@param string $_namespace
@return string|boolean FALSE
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}";
    }
1184957
public function hasNamespace($namespaceName)
    {
        $namespaceName = strtolower($this->getUnquotedAssetName($namespaceName));

        return isset($this->namespaces[$namespaceName]);
    }
611374
function (fullName) {
      if (this.resolver && this.resolver.normalize) {
        return this.resolver.normalize(fullName);
      } else if (this.fallback) {
        return this.fallback.normalizeFullName(fullName);
      } else {
        return fullName;
      }
    }
558375
public function validateNamespace($namespace)
    {
        if (empty($namespace)) {
            $this->addError('namespace', 'Namespace cannot be empty');
            return false;
        }

        if (substr($namespace, 0, 1) !== '/') {
            $this->addError('namespace', 'The namespace have to start with the character "/".');
            return false;
        }

        if (strlen($namespace) > 255) {
            $this->addError('namespace', 'Namespace length cannot exceed 255 chars');
            return false;
        }

        return true;
    }
1059146
public function toNamespacedString($namespace, array $aliased_classes, $this_class, $use_phpdoc_format)
    {
        $base_value = $this instanceof TNamedObject
            ? parent::toNamespacedString($namespace, $aliased_classes, $this_class, $use_phpdoc_format)
            : $this->value;

        if ($base_value === 'non-empty-array') {
            $base_value = 'array';
        }

        if ($use_phpdoc_format) {
            if ($this instanceof TNamedObject || $this instanceof TIterable) {
                return $base_value;
            }

            $value_type = $this->type_params[1];

            if ($value_type->isMixed()) {
                return $base_value;
            }

            $value_type_string = $value_type->toNamespacedString($namespace, $aliased_classes, $this_class, true);

            if (!$value_type->isSingle()) {
                return '(' . $value_type_string . ')[]';
            }

            return $value_type_string . '[]';
        }

        $extra_types = '';

        if ($this instanceof TNamedObject && $this->extra_types) {
            $extra_types = '&' . implode(
                '&',
                array_map(
                    /**
                     * @return string
                     */
                    function (Atomic $extra_type) use ($namespace, $aliased_classes, $this_class) {
                        return $extra_type->toNamespacedString($namespace, $aliased_classes, $this_class, false);
                    },
                    $this->extra_types
                )
            );
        }

        return $base_value .
                '<' .
                implode(
                    ', ',
                    array_map(
                        /**
                         * @return string
                         */
                        function (Union $type_param) use ($namespace, $aliased_classes, $this_class) {
                            return $type_param->toNamespacedString($namespace, $aliased_classes, $this_class, false);
                        },
                        $this->type_params
                    )
                ) .
                '>' . $extra_types;
    }
855078
protected function normalizeName($name)
	{
		$delimiter = ViewFinderInterface::HINT_PATH_DELIMITER;

		if (strpos($name, $delimiter) === false)
		{
			return str_replace('/', '.', $name);
		}

		list($namespace, $name) = explode($delimiter, $name);

		return $namespace . $delimiter . str_replace('/', '.', $name);
	}
151737
public static function normalize($name)
	{
		if (!static::isValid($name))
		{
			throw new InvalidArgumentException("Invalid tag name '" . $name . "'");
		}

		// Non-namespaced tags are uppercased
		if (strpos($name, ':') === false)
		{
			$name = strtoupper($name);
		}

		return $name;
	}
114387
final public function getNamespace(): string
    {
        if (null === $this->namespace) {
            $pos             = strrpos(static::class, '\\');
            $this->namespace = false === $pos ? '' : substr(static::class, 0, $pos);
        }

        return $this->namespace;
    }
1353438
public function get_namespace_parts( $classname, $first_only = false ) {
		// Trim any left-slashes from our string
		$classname = ltrim( $classname, '\\' );

		if ( $first_only === true ) {
			return substr( $classname, 0, strpos( $classname, '\\' ) );
		}

		return explode( '\\', $classname );
	}
982737
protected function filterByNamespace($namespace)
    {
        return function ($file) use ($namespace) {
            $content = file_get_contents($file);
            $tokens = token_get_all($content);

            $count = count($tokens);
            $token_namespace = null;

            for ($i = 0; $i < $count; ++$i) {
                $token = $tokens[$i];

                if (is_array($token) && $token[0] === T_NAMESPACE) {
                    $token_namespace .= '\\';
                    while (++$i < $count) {
                        if ($tokens[$i] === ';') {
                            $namespace = trim($namespace);
                            break;
                        }
                        $token_namespace .= is_array($tokens[$i]) ? trim($tokens[$i][1]) : '';
                    }

                    if ($token_namespace !== $namespace) {
                        return false;
                    }

                    break;
                }
            }

            if (!isset($token_namespace)) {
                return false;
            }
        };
    }
1202674
private function parseFullClassName($fullName)
    {
        $parts = explode("\\", $fullName);
        $name = array_pop($parts);
        $namespace = implode("\\", $parts);
        return [$name, $namespace];
    }
297971
public function hasAttributeNS(string $namespaceURI, string $localName) : bool
    {
        $fullName = '{'.$namespaceURI.'}'.$localName;

        return isset($this->attributes[$fullName]);
    }
1019017
protected static function _namespaceIsset($namespace, $name = null)
    {
        if (self::$_readable === false) {
            /**
             * @see Zend_Session_Exception
             */
            require_once 'Zend/Session/Exception.php';
            throw new Zend_Session_Exception(self::_THROW_NOT_READABLE_MSG);
        }

        if ($name === null) {
            return ( isset($_SESSION[$namespace]) || isset(self::$_expiringData[$namespace]) );
        } else {
            return ( isset($_SESSION[$namespace][$name]) || isset(self::$_expiringData[$namespace][$name]) );
        }
    }
805664
protected function extractNamespace($fullQualifiedNamespace) {
        $parts     = explode('\\', $fullQualifiedNamespace);
        $copyParts = $parts;
        $copyParts = array_splice($copyParts, 0, -1);

        return [
            'namespace'                => implode('\\', $copyParts),
            'class'                    => end($parts),
            'full_qualified_namespace' => $fullQualifiedNamespace
        ];
    }
182915
function parseClassName(fullClassName, namespaces) {
		const result = {};
		let className = fullClassName;
		// Extract the namespace
		if (namespaces.length) {
			const namespaceIndex = namespaces.findIndex((namespace) => {
				return className.startsWith(namespace);
			});
			if (namespaceIndex === -1) {
				return result;
			}
			const namespace = namespaces[namespaceIndex];
			result.namespace = namespace;
			className = className.substr(namespace.length);
		}
		// Handle className with helper prefixes
		const helperPrefix = className.split('-')[0];
		if (validHelperPrefixes.indexOf(helperPrefix) !== -1) {
			result.helper = helperPrefix;
			className = className.substr(helperPrefix.length + 1);
		}
		// Handle classNames with prefixes
		const patternPrefix = className.split('-')[0];
		if (validPatternPrefixes.indexOf(patternPrefix) !== -1) {
			result.pattern = patternPrefix;
			className = className.substr(patternPrefix.length + 1);
		}
		result.name = className;
		result.parts = className.split(/__|--/);
		return result;
	}
459465
public function ns($nameSpace)
    {
        // If ! exist try to load a configuration file 
        if ( !isset($this->nameSpaces[$nameSpace]) ) {
            // short sanitize of nameSpace
            if (!filter_var( $nameSpace,FILTER_VALIDATE_REGEXP, 
                array('options'=>array('regexp' => '/^[\w]+$/')))) {
                    throw new InvalidArgumentException("Invalid configuration name.",400);
            }
            $this->nameSpaces[$nameSpace] = new ContextNameSpace($this->loadArrayFromIniFile($nameSpace));
        }
        
        return $this->nameSpaces[$nameSpace];
    }
105443
public function basename(string $namespace): string
    {
        $strrpos = \strrpos($namespace, '\\');
        if (false === $strrpos) {
            return $namespace;
        }

        return $this->tidy(\substr($namespace, $strrpos + 1));
    }