src/DirHelper.php
protected static function collapseDotFolder($root, $part, &$canonicalParts)
    {
        if ('.' === $part) {
            return;
        }
        // Collapse ".." with the previous part, if one exists
        // Don't collapse ".." if the previous part is also ".."
        if ('..' === $part && count($canonicalParts) > 0
            && '..' !== $canonicalParts[count($canonicalParts) - 1]
        ) {
            array_pop($canonicalParts);
            return;
        }
        // Only add ".." prefixes for relative paths
        if ('..' !== $part || '' === $root) {
            $canonicalParts[] = $part;
        }
    }
protected static function collapseDotFolder($root, $part, &$canonicalParts)
    {
        if ('.' === $part) {
            return;
        }
        // Collapse ".." with the previous part, if one exists
        // Don't collapse ".." if the previous part is also ".."
        if ('..' === $part && count($canonicalParts) > 0
            && '..' !== $canonicalParts[count($canonicalParts) - 1]
        ) {
            array_pop($canonicalParts);
            return;
        }
        // Only add ".." prefixes for relative paths
        if ('..' !== $part || '' === $root) {
            $canonicalParts[] = $part;
        }
    }
protected static function collapseDotFolder ( $ root , $ part , & $ canonicalParts ) { if ( '.' === $ part ) { return ; } // Collapse ".." with the previous part, if one exists // Don't collapse ".." if the previous part is also ".." if ( '..' === $ part && count ( $ canonicalParts ) > 0 && '..' !== $ canonicalParts [ count ( $ canonicalParts ) - 1 ] ) { array_pop ( $ canonicalParts ) ; return ; } // Only add ".." prefixes for relative paths if ( '..' !== $ part || '' === $ root ) { $ canonicalParts [ ] = $ part ; } }
Collapse dot folder '.', '..', if possible
@param string $root
@param $part
@param $canonicalParts
Collapse dot folder . .. if possible