Get available namespaces, and cached it during runtime to avoid
overhead.

@return array|null
767262
protected function getAvailableNamespaces(): ?array
    {
        if (\is_null($this->namespaces)) {
            $this->namespaces = $this->getOriginalContent()->getNameSpaces(true);
        }

        return $this->namespaces;
    }
674344
public function get_namespaces( $force = false ) {
		if( is_null( $this->namespaces ) || $force ) {
			$tArray = array(
				'meta'   => 'siteinfo',
				'action' => 'query',
				'siprop' => 'namespaces'
			);
			$tRes = $this->apiQuery( $tArray );

			foreach( $tRes['query']['namespaces'] as $namespace ){
				$this->namespaces[$namespace['id']] = $namespace['*'];
				$this->allowSubpages[$namespace['id']] = ( ( isset( $namespace['subpages'] ) ) ? true : false );
			}
		}
		return $this->namespaces;
	}
525889
public function getNamespaceNames($absolute = FALSE) {
    $iterator = function(NamespaceNode $ns) use ($absolute) {
      $name = $ns->getName();
      return $absolute ? $name->getAbsolutePath() : $name->getPath();
    };
    return array_map($iterator, $this->getNamespaces()->toArray());
  }
1114228
public function getNamespaces()
    {
        $db = Database::getActiveConnection();

        /** @var PDOStatement $results */
        $results = $db->createQueryBuilder()
            ->select('configNamespace')
            ->from('Config', 'c')
            ->where('configNamespace != ""')
            ->groupBy('configNamespace')
            ->execute();

        return array_map('array_shift', $results->fetchAll());
    }
296117
public function getNamespaces() {
        $namespaces = [];
        foreach ($this->commands as $command) {
            $namespaces = array_merge($namespaces, $this->extractAllNamespaces($command->getName()));

            foreach ($command->getAliases() as $alias) {
                $namespaces = array_merge($namespaces, $this->extractAllNamespaces($alias));
            }
        }

        return array_values(array_unique(array_filter($namespaces)));
    }
135791
protected function getAliasesByExtendsNamespace()
    {
        $aliases = $this->getValidAliases();

        $aliases = $aliases->filter(function (Alias $item) {
            return ! collect([
                'MessageStack',
                'AdminSection',
                'AdminTemplate',
                'AdminNavigation',
                'AdminColumn',
                'AdminColumnEditable',
                'AdminColumnFilter',
                'AdminDisplayFilter',
                'AdminForm',
                'AdminFormElement',
                'AdminDisplay',
            ])->search($item->getAlias());
        });

        return $aliases->groupBy(function (Alias $alias) {
            return $alias->getExtendsNamespace();
        });
    }
653744
function getFormattedNamespaces() {
		$ns = $this->getNamespaces();
		foreach ( $ns as $k => $v ) {
			$ns[$k] = strtr( $v, '_', ' ' );
		}
		return $ns;
	}
754991
public function getControllerNamespaces()
	{
	    $names = [];
	    foreach ($this->controllers as $controller) {
	        $names = array_merge($names, StringHelper::explodeAllPrefixs($controller->getName()));
	        
	        foreach ($controller->getAliases() as $alias) {
	            $names = array_merge($names, StringHelper::explodeAllPrefixs($alias));
	        }
	    }
	    
	    return array_values(array_unique(array_filter($names)));
	}
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;
	}
745778
public function getAliases()
    {
        if ($this->aliases === null) {
            $this->aliases = AliasesParser::parseSource(file_get_contents($this->getFileName()), $this->getNamespaceName());
        }
        return $this->aliases;
    }
43564
protected function getNamespacesFromClass($namespace)
    {
        $classStack = [$namespace];
        $classStack = array_merge($classStack, class_parents($namespace));
        $classStack = array_merge($classStack, class_implements($namespace));

        return $classStack;
    }
524392
protected function retrieveNamespace()
    {
        if (! isset($this->syntaxTree[0]) || ! ($this->syntaxTree[0] instanceof Namespace_)) {
            throw new Exception("Could not locate namespace definition for class '".$this->classShortName."'");
        }

        $this->namespace = $this->syntaxTree[0];

        return $this;
    }
569375
public function getEntityNamespace()
    {
        $namespace = '';
        if (($bundleNamespace = $this->parseComment('bundleNamespace')) || ($bundleNamespace = $this->getConfig()->get(Formatter::CFG_BUNDLE_NAMESPACE))) {
            $namespace = $bundleNamespace.'\\';
        }
        if ($entityNamespace = $this->getConfig()->get(Formatter::CFG_ENTITY_NAMESPACE)) {
            $namespace .= $entityNamespace;
        } else {
            $namespace .= 'Entity';
        }

        return $namespace;
    }
464418
public function getNamespaces()
	{
		$namespaces = $this->instance->getInstanceNamespaces();

		$usedNamespaces = array_reduce( $this->elements, function( $carry, $element ) use( $namespaces ) {

			foreach ( $element as $key => $entry )
			{
				$namespace = isset( $namespaces[ $entry['namespace'] ] ) ? $namespaces[ $entry['namespace'] ] : $entry['namespace'];
				if ( ! isset( $carry[ $namespace ] ) )
					$carry[ $namespace ] = 1;
			}

			return $carry;
		}, array() );

		return array_keys( $usedNamespaces );
	}
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;
    }
354502
public function getNamespaceInfo()
    {
        if (empty($this->name)) {
            throw new \RuntimeException('Internal error: SplClassInfo failed to retrieve the reflection object');
        }

        return new SplNamespaceInfo($this->name, $this->getFileName());
    }
855740
public function getDocumentNamespaces()
	{
		if ( ! $this->documentPrefixes )
		{
			if ( ! property_exists( $this, 'xbrlDocument' ) ) return null;
			$this->documentPrefixes = $this->xbrlDocument->getDocNamespaces( true );
		}

		return $this->documentPrefixes;
	}