src/Changes.php
public function subtree($path, string &$name = null, bool $create = false): ?self
    {
        $parts = $this->split($path);

        $dirOrFile = array_shift($parts);
        if (!count($parts)) {
            $name = $dirOrFile;
            $subtree = $this;
        } else {
            $exists = isset($this->subTrees[$dirOrFile]);
            if (!$exists && !$create) {
                $subtree = null;
                $name = null;
            } else {
                if (!$exists && $create) {
                    $this->subTrees[$dirOrFile] = new self();
                }
                $subtree = $this->subTrees[$dirOrFile]->subtree($parts, $name, $create);
            }
        }

        return $subtree;
    }
public function subtree($path, string &$name = null, bool $create = false): ?self
    {
        $parts = $this->split($path);

        $dirOrFile = array_shift($parts);
        if (!count($parts)) {
            $name = $dirOrFile;
            $subtree = $this;
        } else {
            $exists = isset($this->subTrees[$dirOrFile]);
            if (!$exists && !$create) {
                $subtree = null;
                $name = null;
            } else {
                if (!$exists && $create) {
                    $this->subTrees[$dirOrFile] = new self();
                }
                $subtree = $this->subTrees[$dirOrFile]->subtree($parts, $name, $create);
            }
        }

        return $subtree;
    }
public function subtree ( $ path , string & $ name = null , bool $ create = false ) : ? self { $ parts = $ this -> split ( $ path ) ; $ dirOrFile = array_shift ( $ parts ) ; if ( ! count ( $ parts ) ) { $ name = $ dirOrFile ; $ subtree = $ this ; } else { $ exists = isset ( $ this -> subTrees [ $ dirOrFile ] ) ; if ( ! $ exists && ! $ create ) { $ subtree = null ; $ name = null ; } else { if ( ! $ exists && $ create ) { $ this -> subTrees [ $ dirOrFile ] = new self ( ) ; } $ subtree = $ this -> subTrees [ $ dirOrFile ] -> subtree ( $ parts , $ name , $ create ) ; } } return $ subtree ; }
Get subtree by path.

@param string|array $path
Get subtree by path .