src/FileInfo.php
protected function cleanPath($path)
    {
        $path    = str_replace('\\', '/', $path);
        $path    = explode('/', $path);
        $newpath = array();
        foreach ($path as $p) {
            if ($p === '' || $p === '.') {
                continue;
            }
            if ($p === '..') {
                array_pop($newpath);
                continue;
            }
            array_push($newpath, $p);
        }
        return trim(implode('/', $newpath), '/');
    }
protected function cleanPath($path)
    {
        $path    = str_replace('\\', '/', $path);
        $path    = explode('/', $path);
        $newpath = array();
        foreach ($path as $p) {
            if ($p === '' || $p === '.') {
                continue;
            }
            if ($p === '..') {
                array_pop($newpath);
                continue;
            }
            array_push($newpath, $p);
        }
        return trim(implode('/', $newpath), '/');
    }
protected function cleanPath ( $ path ) { $ path = str_replace ( '\\' , '/' , $ path ) ; $ path = explode ( '/' , $ path ) ; $ newpath = array ( ) ; foreach ( $ path as $ p ) { if ( $ p === '' || $ p === '.' ) { continue ; } if ( $ p === '..' ) { array_pop ( $ newpath ) ; continue ; } array_push ( $ newpath , $ p ) ; } return trim ( implode ( '/' , $ newpath ) , '/' ) ; }
Cleans up a path and removes relative parts, also strips leading slashes

@param string $path
@return string
Cleans up a path and removes relative parts also strips leading slashes