src/Builder.php
protected function normalizePath($path, $sep='/')
    {
        $path = $this->normalizeSlashes($path, $sep);
        $out = [];
        foreach (explode($sep, $path) as $i => $fold) {
            if ($fold == '..' && $i > 0 && end($out) != '..') array_pop($out);
            $fold = preg_replace('/\.{2,}/', '.', $fold);
            if ($fold == '' || $fold == '.') continue;
            else $out[] = $fold;
        }
        return ($path[0] == $sep ? $sep : '') . join($sep, $out);
    }
protected function normalizePath($path, $sep='/')
    {
        $path = $this->normalizeSlashes($path, $sep);
        $out = [];
        foreach (explode($sep, $path) as $i => $fold) {
            if ($fold == '..' && $i > 0 && end($out) != '..') array_pop($out);
            $fold = preg_replace('/\.{2,}/', '.', $fold);
            if ($fold == '' || $fold == '.') continue;
            else $out[] = $fold;
        }
        return ($path[0] == $sep ? $sep : '') . join($sep, $out);
    }
protected function normalizePath ( $ path , $ sep = '/' ) { $ path = $ this -> normalizeSlashes ( $ path , $ sep ) ; $ out = [ ] ; foreach ( explode ( $ sep , $ path ) as $ i => $ fold ) { if ( $ fold == '..' && $ i > 0 && end ( $ out ) != '..' ) array_pop ( $ out ) ; $ fold = preg_replace ( '/\.{2,}/' , '.' , $ fold ) ; if ( $ fold == '' || $ fold == '.' ) continue ; else $ out [ ] = $ fold ; } return ( $ path [ 0 ] == $ sep ? $ sep : '' ) . join ( $ sep , $ out ) ; }
Normalize a file path string to remove ".." etc.
@param string $path
@param string $sep Path separator to use in output
@return string
Normalize a file path string to remove .. etc .