Gibt das Verzeichnis eines Namespaces in einem Verzeichnis zurück

dies nimmt einfach den Namespace
@return Dir absolute im angegebenen $classPath oder in $this->getClassPath()
168841
public function namespaceToPath($namespace, Dir $classPath = NULL) {
    $cp = $classPath ?: $this->getClassPath()->up();
    
    // end und anfangs backslashs weg
    $namespace = trim($namespace,'\\'); 
    
    $dir = $cp->sub(str_replace('\\','/',$namespace).'/');
    
    return $dir;
  }
975109
public function createClasspath()
    {
        if ($this->isReference()) {
            throw $this->tooManyAttributes();
        }
        if ($this->classpath === null) {
            $this->classpath = new Path($this->project);
        }

        return $this->classpath->createPath();
    }
1180828
public function getRootPath()
    {
        if (null === $this->rootPath) {
            if (method_exists($this, 'setRootPath')) {
                $this->rootPath = realpath($this->setRootPath());
            } else {
                $this->rootPath = realpath(__DIR__.'/../../../../..');
            }
        }
        //$this->rootPath = '../';

        return $this->rootPath;
    }
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;
    }
242827
public function getPath(): string
	{
		if($this->path === null)
		{
			$this->path = dirname((new ReflectionClass($this))->getFileName(), 2);
		}

		return $this->path;
	}
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;
	}
1170844
private static File[] classPath() {
        final String[] fileNames =
                System.getProperty("java.class.path").split(File.pathSeparator);
        final File[] files = new File[fileNames.length];
        for (int i = 0; i < files.length; ++i) {
            files[i] = new File(fileNames[i]);
        }
        return files;
    }
433130
public function getFullQualifiedNamespace() {
        if(empty($this->fullQualifiedNamespace) && !empty($this->class)){
            $this->fullQualifiedNamespace = $this->getFullQualifiedNamespaceTrait($this->namespace, $this->class);
        }

        return $this->fullQualifiedNamespace;
    }
968578
public function appNameSpace()
    {
        $app_dir = $this->appDir();
        $root_dir = $this->rootDir();
        $ns_path = substr($app_dir, strlen($root_dir) + 1);
        return str_replace(DS, '\\', $ns_path);
    }
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;
    }
570670
public function getRelativePath()
    {
        $packageHandle = $this->getPackageHandle();
        if (is_dir($this->DIR_PACKAGES . '/' . $packageHandle)) {
            $result = $this->REL_DIR_PACKAGES . '/' . $packageHandle;
        } else {
            $result = $this->REL_DIR_PACKAGES_CORE . '/' . $packageHandle;
        }

        return $result;
    }
40408
public function getDirectory()
    {
        $dir = new Directory($this->getDirname());

        $namespaces = explode('\\', $this->getNameSpace());
        array_pop($namespaces);
        $dir->setNamespace(join('\\', $namespaces));

        return $dir;
    }
381377
protected static function getResolvedClassInstance()
    {
        $classNamespace = static::getStaticClassAccessor();
        $resolvedClassInstance = self::getClass($classNamespace);
        
        if (! $resolvedClassInstance) {
            return self::resolveClassNameSpace($classNamespace);  
        }

        return $resolvedClassInstance;
    }
676250
public static function getNamespaceByPath($path, $is_dir = true)
    {
        // when relational path.
        if ($path[0] !== '/')
            return null;
        
        $root_ns = '';
        $filepath = $path;
        foreach (self::$namespaces as $p => $ns) {
            if (strpos($path, $p) !== false) {
                $root_ns = $ns;
                $filepath = substr($path, strlen($p) + 1);
                break;
            }
        }

        $ns = $filepath ? explode(DS, $filepath) : [];
        if (! $is_dir)
            array_pop($ns);
        array_unshift($ns, $root_ns);

        return join('\\', $ns);
    }
1256445
function from($namespacePath)
    {
        if ($namespacePath === '')
            # from recursion calls
            return $this;

        // ..

        $cNamespace = $this->_normalizeNamespace($namespacePath);

        if (false === strstr($cNamespace, self::SEPARATOR)) {
            ## recursion fallback here !!
            if (!isset($this->__nestRight[$cNamespace]))
                return false;

            return $this->__nestRight[$cNamespace];
        }

        // ..

        $namespacePath = rtrim($namespacePath, self::SEPARATOR);
        $brkNamespace  = explode(self::SEPARATOR, $namespacePath);


        ## /root/to/nested/namespace
        $cNamespace   = array_shift($brkNamespace);
        $cContainer   = $this;
        if ($cNamespace === '') {
            ## Start with / (separator)
            #- Goto Root Container
            while ($cContainer->__nestLeft)
                $cContainer = $cContainer->__nestLeft;
        }
        else $cContainer = $this->from($cNamespace); ## fallback

        ## fallback recursion from root parent
        return ($cContainer == false) ? $cContainer : $cContainer->from(implode(self::SEPARATOR, $brkNamespace));
    }
110794
private function getLibPath()
    {
        $reflection = new ReflectionClass('Behat\Gherkin\Gherkin');
        $libPath = rtrim(dirname($reflection->getFilename()) . '/../../../', DIRECTORY_SEPARATOR);

        return $libPath;
    }
903412
public function getXPath()
    {
      if(!isset($this->xpath))
      {
        $this->xpath = new DOMXPath($this);

        if($this->documentElement->namespaceURI <> '')
          $this->xpath->registerNamespace('default', $this->documentElement->namespaceURI);

        /*foreach ($this->getNamespaces() as $prefix => $namespaceUri)
          $this->xpath->registerNamespace($prefix, $namespaceUri);*/
      }

      return $this->xpath;
    }