Main entry point to retrieve the unique NamespaceManager instance

@access public
@author Jerome Bogaerts, <jerome.bogaerts@tudor.lu>
@return common_ext_NamespaceManager
356029
public static function singleton()
    {
        $returnValue = null;

        
        
        if(is_null(self::$instance)){
        	$class = __CLASS__;				//used in case of subclassing
        	self::$instance = new $class();
        }
        $returnValue = self::$instance;
        
        

        return $returnValue;
    }
1179611
public static function & GetNamespace (
		$name = \MvcCore\ISession::DEFAULT_NAMESPACE_NAME
	) {
		if (!static::GetStarted()) static::Start();
		if (!isset(static::$instances[$name])) {
			static::$instances[$name] = new static($name);
		}
		/** @var $result \MvcCore\Session */
		$result = & static::$instances[$name];
		return $result;
	}
342779
public function extractNamespace()
    {
        $namespaceParts = [];
        $tokens = token_get_all($this->phpCode);
        $numberOfTokens = count($tokens);
        for ($i = 0; $i < $numberOfTokens; $i++) {
            $token = $tokens[$i];
            if (is_string($token) || $token[0] !== T_NAMESPACE) {
                continue;
            }
            for (++$i; $i < $numberOfTokens; $i++) {
                $token = $tokens[$i];
                if (is_string($token)) {
                    break;
                }
                list($type, $value) = $token;
                if ($type === T_STRING) {
                    $namespaceParts[] = $value;
                    continue;
                }
                if ($type !== T_NS_SEPARATOR && $type !== T_WHITESPACE) {
                    break;
                }
            }
            break;
        }
        if ($namespaceParts === []) {
            return null;
        }
        return implode('\\', $namespaceParts);
    }
1283234
protected function _namespaceNode()
    {
        $this->_codeNode();
        $this->_flushUses();
        $body = $this->_stream->current();
        $name = $this->_stream->next([';', '{']);
        $this->_states['body'] .= $body;
        $node = new BlockDef($body . $name, 'namespace');
        $node->hasMethods = false;
        $node->name = trim(substr($name, 0, -1));
        $this->_states['current'] = $this->_root;
        $this->_contextualize($node);
        return $this->_states['current'] = $node->namespace = $node;
    }
816865
public function getRootNamespace()
    {
        if (($psr4 = $this->get('autoload.psr-4')) === null) {
            return null;
        }

        foreach ($psr4 as $namespace => $namespacePaths) {
            foreach ((array)$namespacePaths as $namespacePath) {
                // The namespace path should be a subdirectory of the "src" directory
                if (mb_strpos(realpath($this->rootPath . '/' . $namespacePath), realpath($this->psr4RootPath)) === 0) {
                    return rtrim($namespace, '\\');
                }
            }
        }

        return null;
    }
1026174
public function getNamespaceFactory() {
		if ($this->_namespacesFactory === null) {
			if ($this instanceof LocatorAwareInterface && $this->hasLocator()) {
				$this->_namespacesFactory = $this->getLocator()->get($this->getSessionNamespaceFactoryServiceId());
				
				if (! $this->_namespacesFactory instanceof NamespaceFactoryInterface) {
					throw new NoNamespacesFactory('Namespace\'s factory must implement the "HelpersLocatorInterface"');
				}
			} else {
				throw new NoNamespacesFactory('No namespace\'s factory been supplied, also unable to obtain one through locator');
			}
		}
		
		return $this->_namespacesFactory;
	}
455379
public function getNamespaceMappings()
	{
		$dom = (new XmlDocumentBuilder())->buildDocument($this);
		$xpath = new \DOMXPath($dom);
		
		$namespaces = [];
		
		foreach($xpath->query('namespace::*', $dom->documentElement) as $result)
		{
			$namespaces[(string)$result->prefix] = (string)$result->nodeValue;
		}
		
		return $namespaces;
	}
63377
public function getNamespaceList()
    {
        if (!isset($this->_namespaceList)) $this->getBasePathList();
        static::$_modulesNs[$this::className()] = $this->_namespaceList;
        return $this->_namespaceList;
    }
685882
public function getNamespace()
    {
        $class       = array();
        $inNamespace = false;

        foreach ($this->tokenlist as $key => $token) {
            if (T_NAMESPACE === $token[0]) {
                $inNamespace = true;
                continue;
            }
            if (T_STRING === $token[0] && $inNamespace) {
                $class[] = $token[1];

            }
            if (';' === $token && $inNamespace) {
                return $class;
            }
        }

        return array();
    }
1306237
protected function getConfigurationManager()
	{
		if (!isset($this->configurationManager)) {
			$this->configurationManager = GeneralUtility::makeInstance(ObjectManager::class)
				->get(ConfigurationManager::class);
		}
		return $this->configurationManager;
	}
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;
	}
34137
protected function createFilterManager()
    {
        $manager = new FilterManager();
        $filters = Config::get($this->namespace.'::filters', array());
        foreach ($filters as $name => $filter) {
            $manager->set($name, $this->createFilter($filter));
        }

        return $this->filters = $manager;
    }
503178
public function getNamespaces()
    {
        $namespaces = [];

        foreach ($this->paths as $namespace => $paths) {
            if (count($paths)) {
                $namespaces[] = $namespace;
            }
        }

        return $namespaces;
    }
789541
public function compile()
    {
        $translator = $this
            ->checkNamespace($this->configuration)
            ->checkAlias($this->configuration)
            ->checkMethods($this->configuration)
            ->createTranslator();

        return $translator;
    }
1183209
function getNamespace() {
    if (FALSE === $pos = strrpos($this->fqcnStr, '\\')) {
      return NULL;
    }
    $namespaceFqcnStr = substr($this->fqcnStr, 0, $pos);
    return self::createFromValidFqcnString($namespaceFqcnStr);
  }
767262
protected function getAvailableNamespaces(): ?array
    {
        if (\is_null($this->namespaces)) {
            $this->namespaces = $this->getOriginalContent()->getNameSpaces(true);
        }

        return $this->namespaces;
    }
314408
protected function getAppNamespace()
    {
        $composer = json_decode(file_get_contents(base_path().'/composer.json'), true);

        foreach ((array) data_get($composer, 'autoload.psr-4') as $namespace => $path) {
            foreach ((array) $path as $pathChoice) {
                if (realpath(app_path()) == realpath(base_path().'/'.$pathChoice)) {
                    return $namespace;
                }
            }
        }

        throw new \RuntimeException('Unable to detect application namespace.');
    }