public static function removeBasepath($uri, $path)
    {
        $uri = self::normalizePath(self::filterUri($uri));
        $basepath = (new HierarchicalPath($path))->withLeadingSlash();
        if ('/' === (string) $basepath) {
            return $uri;
        }

        $currentpath = $uri->getPath();
        if (0 !== strpos($currentpath, (string) $basepath)) {
            return $uri;
        }

        return $uri->withPath(
            (string) (new HierarchicalPath($currentpath))->withoutSegment(...range(0, count($basepath) - 1))
        );
    }
public static function removeBasepath($uri, $path)
    {
        $uri = self::normalizePath(self::filterUri($uri));
        $basepath = (new HierarchicalPath($path))->withLeadingSlash();
        if ('/' === (string) $basepath) {
            return $uri;
        }

        $currentpath = $uri->getPath();
        if (0 !== strpos($currentpath, (string) $basepath)) {
            return $uri;
        }

        return $uri->withPath(
            (string) (new HierarchicalPath($currentpath))->withoutSegment(...range(0, count($basepath) - 1))
        );
    }
public static function removeBasepath ( $ uri , $ path ) { $ uri = self :: normalizePath ( self :: filterUri ( $ uri ) ) ; $ basepath = ( new HierarchicalPath ( $ path ) ) -> withLeadingSlash ( ) ; if ( '/' === ( string ) $ basepath ) { return $ uri ; } $ currentpath = $ uri -> getPath ( ) ; if ( 0 !== strpos ( $ currentpath , ( string ) $ basepath ) ) { return $ uri ; } return $ uri -> withPath ( ( string ) ( new HierarchicalPath ( $ currentpath ) ) -> withoutSegment ( ... range ( 0 , count ( $ basepath ) - 1 ) ) ) ; }
Remove a basepath from the URI path.

@return Psr7UriInterface|UriInterface
Remove a basepath from the URI path .