protected function splitPathToSegments($path)
    {
        $path = MediaLibrary::validatePath($path, true);
        $path = explode('/', ltrim($path, '/'));

        $result = [];
        while (count($path) > 0) {
            $folder = array_pop($path);

            $result[$folder] = implode('/', $path).'/'.$folder;
            if (substr($result[$folder], 0, 1) != '/') {
                $result[$folder] = '/'.$result[$folder];
            }
        }

        return array_reverse($result, true);
    }
protected function splitPathToSegments($path)
    {
        $path = MediaLibrary::validatePath($path, true);
        $path = explode('/', ltrim($path, '/'));

        $result = [];
        while (count($path) > 0) {
            $folder = array_pop($path);

            $result[$folder] = implode('/', $path).'/'.$folder;
            if (substr($result[$folder], 0, 1) != '/') {
                $result[$folder] = '/'.$result[$folder];
            }
        }

        return array_reverse($result, true);
    }
protected function splitPathToSegments ( $ path ) { $ path = MediaLibrary :: validatePath ( $ path , true ) ; $ path = explode ( '/' , ltrim ( $ path , '/' ) ) ; $ result = [ ] ; while ( count ( $ path ) > 0 ) { $ folder = array_pop ( $ path ) ; $ result [ $ folder ] = implode ( '/' , $ path ) . '/' . $ folder ; if ( substr ( $ result [ $ folder ] , 0 , 1 ) != '/' ) { $ result [ $ folder ] = '/' . $ result [ $ folder ] ; } } return array_reverse ( $ result , true ) ; }
Splits a path in to segments
@param string $path
@return array
Splits a path in to segments