Get the list of namespaces of this Document

@return array
330427
private function getNamespaces()
    {
      $this->namespaces = array();

      $nodeList = $this->documentElement->getElementsByTagName('*');

      foreach($nodeList as $node)
      {
        if (strlen($node->prefix) && strlen($node->namespaceURI) && !in_array($node->prefix, $this->namespaces))
          $this->namespaces[$node->prefix] = $node->namespaceURI;
      }

      return $this->namespaces;
    }
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 );
	}
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());
  }
1083782
public function getAllElements()
	{
		if ( $this->context->isExtensionTaxonomy() )
		{
			$prefix = $this->getPrefix();
			return array_map( function( $item ) use ( $prefix ) { $item['prefix'] = $prefix; return $item; }, $this->elementIndex );
		}

		$result = array();
		foreach ( $this->context->importedSchemas as $namespace => $taxonomy )
		{
			$elements = $taxonomy->getElements();
			if ( ! $elements ) continue; // Don't attempt to merge if there are no element and it take time
			$prefix = $taxonomy->getPrefix();
			$elements = array_map( function( $item ) use ( $prefix ) { $item['prefix'] = $prefix; return $item; }, $elements );
			$result = array_merge( $result, $elements );
		}
		return $result;
	}
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;
    }
510586
private function findNamespaceAliases()
    {
        $namespaceAliases = [];

        // aliases can be only top-level nodes in the namespace, so we can scan them directly
        foreach ($this->namespaceNode->stmts as $namespaceLevelNode) {
            if ($namespaceLevelNode instanceof Use_) {
                $useAliases = $namespaceLevelNode->uses;
                if (!empty($useAliases)) {
                    foreach ($useAliases as $useNode) {
                        $namespaceAliases[$useNode->name->toString()] = $useNode->alias;
                    }
                }
            }
        }

        return $namespaceAliases;
    }
1165174
public static function getAutoloadNamespaces() {
		// FIXME: adapt this to PSR-4!
		$composer = json_decode(file_get_contents(__DIR__."/../../../../../composer.json"), true);
		
		if (isset($composer["autoload"]["psr-0"])) {
			$autoload = $composer["autoload"]["psr-0"];
		}
                else {
                    return null;
                }
		
		if (self::isAssoc($autoload)) {
			return self::unfactorizeAutoload(array($autoload));
		} else {
			return self::unfactorizeAutoload($autoload);
		}		
	}
189040
private function findClasses()
    {
        $classes       = array();
        $namespaceName = $this->getName();
        // classes can be only top-level nodes in the namespace, so we can scan them directly
        foreach ($this->namespaceNode->stmts as $namespaceLevelNode) {
            if ($namespaceLevelNode instanceof ClassLike) {
                $classShortName = $namespaceLevelNode->name->toString();
                $className = $namespaceName ? $namespaceName .'\\' . $classShortName : $classShortName;

                $namespaceLevelNode->setAttribute('fileName', $this->fileName);
                $classes[$className] = new ReflectionClass($className, $namespaceLevelNode);
            }
        }

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

		return $this->documentPrefixes;
	}
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);
    }
90470
public function getNamespace($ns) {
    $namespaces = $this
      ->getNamespaces()
      ->filter(function(NamespaceNode $node) use ($ns) {
        return $node->getName()->getPath() === $ns;
      });

    return $namespaces->isEmpty() ? NULL : $namespaces[0];
  }
1138704
public function getSpacesAndContentTypesAsChoices(): array
    {
        $spaces = [];

        foreach ($this->clientsConfig as $clientConfig) {
            /** @var \Contentful\Delivery\Client $client */
            $client = $clientConfig['service'];

            $contentTypes = [];
            foreach ($client->getContentTypes()->getItems() as $contentType) {
                /* @var \Contentful\Delivery\Resource\ContentType $contentType */
                $contentTypes[$contentType->getName()] = $contentType->getId();
            }
            $spaces[$client->getSpace()->getName()] = $contentTypes;
        }

        return $spaces;
    }
491247
public static function getBackendAjaxClassNames()
    {
        $nameSpace = __NAMESPACE__ . '\\PageSeo';
        $ajaxPrefix = self::AJAX_PREFIX;

        return array(
            //$ajaxPrefix . PageSeo\AdvancedController::LIST_TYPE
            //  => $nameSpace . '\\' . 'AdvancedController',//unused
            $ajaxPrefix . PageSeo\GeoController::LIST_TYPE           => $nameSpace . '\\' . 'GeoController',
            $ajaxPrefix . PageSeo\MetaDataController::LIST_TYPE      => $nameSpace . '\\' . 'MetaDataController',
            $ajaxPrefix . PageSeo\PageTitleController::LIST_TYPE     => $nameSpace . '\\' . 'PageTitleController',
            $ajaxPrefix . PageSeo\PageTitleSimController::LIST_TYPE  => $nameSpace . '\\' . 'PageTitleSimController',
            $ajaxPrefix . PageSeo\SearchEnginesController::LIST_TYPE => $nameSpace . '\\' . 'SearchEnginesController',
            $ajaxPrefix . PageSeo\UrlController::LIST_TYPE           => $nameSpace . '\\' . 'UrlController',
        );
    }
208643
public function detectNamespacesFromDocument( $doc )
	{
		$namespaces	= self::getNamespacesFromDocument( $element );
		$this->namespaces	= array_merge( $this->namespaces, $namespaces );
		return count( $namespaces );
	}
999495
private function _namespace() {
    $node = new NamespaceNode();
    $this->matchDocComment($node);
    $this->mustMatch(T_NAMESPACE, $node);
    if ($this->currentType === T_STRING) {
      $name = $this->namespaceName();
      $node->addChild($name, 'name');
    }
    $this->matchHidden($node);
    $body = new StatementBlockNode();
    if ($this->tryMatch('{', $body)) {
      $this->topStatementList($body, '}');
      $this->mustMatch('}', $body);
      $node->addChild($body, 'body');
    }
    else {
      $this->endStatement($node);
      $this->matchHidden($node);
      $node->addChild($this->namespaceBlock(), 'body');
    }
    return $node;
  }
386754
public function getNamespaceName()
    {
        $parts = $this->node->consts[0]->namespacedName->parts;
        array_pop($parts);
        return implode('\\', $parts);
    }