public function clean($path)
    {
        $tokens = [];
        $path = $this->cleanPath($path);
        $prefix = $this->prefix($path);
        $path = substr($path, strlen($prefix));
        $parts = array_filter(explode('/', $path), 'strlen');

        foreach ($parts as $part) {
            if ('..' === $part) {
                array_pop($tokens);
            } elseif ('.' !== $part) {
                $tokens[] = $part;
            }
        }

        return $prefix . implode('/', $tokens);
    }
public function clean($path)
    {
        $tokens = [];
        $path = $this->cleanPath($path);
        $prefix = $this->prefix($path);
        $path = substr($path, strlen($prefix));
        $parts = array_filter(explode('/', $path), 'strlen');

        foreach ($parts as $part) {
            if ('..' === $part) {
                array_pop($tokens);
            } elseif ('.' !== $part) {
                $tokens[] = $part;
            }
        }

        return $prefix . implode('/', $tokens);
    }
public function clean ( $ path ) { $ tokens = [ ] ; $ path = $ this -> cleanPath ( $ path ) ; $ prefix = $ this -> prefix ( $ path ) ; $ path = substr ( $ path , strlen ( $ prefix ) ) ; $ parts = array_filter ( explode ( '/' , $ path ) , 'strlen' ) ; foreach ( $ parts as $ part ) { if ( '..' === $ part ) { array_pop ( $ tokens ) ; } elseif ( '.' !== $ part ) { $ tokens [ ] = $ part ; } } return $ prefix . implode ( '/' , $ tokens ) ; }
Normalize and clean path.

@param string $path ("C:\server\test.dev\file.txt")
@return string
Normalize and clean path .